Sponsored Content
Full Discussion: Configure Tomcat to syslog
Operating Systems Linux Red Hat Configure Tomcat to syslog Post 302392593 by sidhurana on Friday 5th of February 2010 12:11:19 AM
Old 02-05-2010
Log4j properties file

Hi Murphy,

Thanks for the reply...

Following log4j.properties file is from /classes ( Tomcat application)

Code:
log4j.rootLogger=WARN, file, SYSLOG
  
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.append=true
log4j.appender.file.File=/var/logs/apache/tomcat.log
log4j.appender.file.MaxFileSize=5MB 
log4j.appender.file.maxBackupIndex=10 
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{DATE} - [%t] - %C{1}.%M(%L) - %p: %m%n

log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.SyslogHost=127.0.0.1
log4j.appender.SYSLOG.Facility=LOCAL0
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%-4r %-5p %c{2} %M.%L %x - %m\n
log4j.appender.SYSLOG.threshold=DEBUG
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL

# OpenSymphony Stuff
log4j.logger.net.apache.framework=DEBUG
log4j.logger.net.apache=DEBUG
log4j.logger.org.apache.struts2=ERROR
log4j.logger.org.hibernate.type=ERROR
log4j.logger.org.hibernate.SQL=ERROR


In Syslog we have this entry for tomcat logs :-
/etc/syslog.conf
Code:
LOCAL0.*                                                /var/logs/apache/tomcat.log

*.*         192.168.10.1 (IP of syslog server)


I also do have a file in tomcat's /lib for log4j.properties that looks like:-


Code:
log4j.rootLogger=DEBUG,SYSLOG
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.SyslogHost=127.0.0.1
log4j.appender.SYSLOG.facility=LOCAL1
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.SYSLOG.layout.ConversionPattern=%-4r %-5p %c {2} %M. %L %x - %m\n

Please let me know what are the important lines for logging purposes.

Regards,
Sudhir

Last edited by pludi; 02-05-2010 at 02:16 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Tomcat configuration

i want to use jsp and servlets on my fedora core 6 system.So,I want to run tomcat.i dont how to configure tomcat in linux. the command:service tomcat5 start is working but http://localhost/8180 or http://localhost:8080 are not working plzzzz help (1 Reply)
Discussion started by: preeti chouhan
1 Replies

2. AIX

Is Tomcat 4.1.24 supported on AIX 5.3 TL 7?

I am trying to upgrade JDK to 1.5 on AIX 5.3 TL 02, but get an error to upgrade AIX to TL 07. Tomcat 4.1.24 is installed. Just wondering if the the AIX upgrade to TL 07 will have any effect to Tomcat? Help is appreciated (1 Reply)
Discussion started by: aajmani
1 Replies

3. Solaris

How to start tomcat with 2 jdk?

Current platform: Sun OS 5.9 Solaris isainfo -v 64-bit sparcv9 applications 32-bit sparc applications Problem: Fail to start tomcat server ps -ef | grep tomcat nothing displays... Steps: Installed jakarta-tomcat-5.0.30 Installed jdk 1.6 and set path in profile... (11 Replies)
Discussion started by: sbox
11 Replies

4. Cybersecurity

how to configure ssl for tomcat 6

Hi, my server is running a tomcat servlet container. yesterday a bought a ssl-certificate from geotrust.com. i got a private-key file and a cert-file (PKCS10). i followed the instructions on Apache Tomcat 6.0 - SSL Configuration HOW-TO first, i created a keystore: ... (0 Replies)
Discussion started by: mcW
0 Replies

5. Solaris

tomcat installation

hi.. i need to install tomcat on my solaris 10 x86 OS.. can u please guide me .. i know that tomcat is already present in solaris 10 x86.. tell me how to enable it.. tel me as soon as possible.. i tried but its throwing me the following error.. The JAVA_HOME environment variable is not... (5 Replies)
Discussion started by: senkerth
5 Replies

6. Linux

How to send from Tomcat log (catelina.out) to Syslog?

Dear All:) We want to send log message from Tomcat Log to Syslog. So we have configured as follows: Our environment: Tomcat 5.5 with CentOS 5.6 Final version (32Bit) log4j.properties file location: /usr/share/tomcat5/common/classes log4j-1.2.16.jar and commons-logging-1.1.1.jar... (2 Replies)
Discussion started by: ziosnim
2 Replies

7. Shell Programming and Scripting

Multiple instance in tomcat

I need to install a tomcat6 with multiple instances like instance1,instance2 and instance3 in a server. I came to know that for that we need to install tomcat6,apache2.0,mod_jk1.2 and jre with tools.jar installed.And we need to create multiple instances with same web.xml and difference... (0 Replies)
Discussion started by: tuxslonik
0 Replies

8. Solaris

Tomcat installation

Hi Friends, I have a upgrade task of tomcat from 5.5.20 to latest 7.0.32 stable release on solaris 10 sparc 64 bit.. Is tomcat package same for solaris 10 x86 and sparc 64bit..?? Can we upgrade directly from 5 to 7? Please help me.. (1 Reply)
Discussion started by: phani4u
1 Replies

9. Solaris

Tomcat..Unable to deploy application remotely in tomcat

Hi, We have upgrade tomcat from 5.0.20 to 7.0.33 and made changes to server.xml file according to newer version.. how ever the upgrade went fine and now i am unable to deploy application remotely.. it is giving 403 access denied error.. we have seperate appbase directory mentioned in server.xml..... (0 Replies)
Discussion started by: phani4u
0 Replies

10. Linux

How to push Tomcat logs to remote syslog server?

I found a script for automatically push tomcat logs to syslog server which is locate in same server. How do I change it to push logs to remote server? log4j.rootLogger=INFO, WARN, console, file, SYSLOG log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.append=true... (2 Replies)
Discussion started by: heshandh
2 Replies
JavaMap(3)						User Contributed Perl Documentation						JavaMap(3)

NAME
Log::Log4perl::JavaMap - maps java log4j appenders to Log::Dispatch classes SYNOPSIS
############################### log4j.appender.FileAppndr1 = org.apache.log4j.FileAppender log4j.appender.FileAppndr1.File = /var/log/onetime.log log4j.appender.FileAppndr1.Append = false log4j.appender.FileAppndr1.layout = org.apache.log4j.PatternLayout log4j.appender.FileAppndr1.layout.ConversionPattern=%d %4r [%t] %-5p %c %x - %m%n ############################### DESCRIPTION
If somebody wants to create an appender called "org.apache.log4j.ConsoleAppender", we want to translate it to Log::Dispatch::Screen, and then translate the log4j options into Log::Dispatch parameters.. What's Implemented (Note that you can always use the Log::Dispatch::* module. By 'implemented' I mean having a translation class that translates log4j options into the Log::Dispatch options so you can use log4j rather than log4perl syntax in your config file.) Here's the list of appenders I see on the current (6/2002) log4j site. These are implemented ConsoleAppender - Log::Dispatch::Screen FileAppender - Log::Dispatch::File RollingFileAppender - Log::Dispatch::FileRotate (by Mark Pfeiffer) JDBCAppender - Log::Log4perl::Appender::DBI SyslogAppender - Log::Dispatch::Syslog NTEventLogAppender - Log::Dispatch::Win32EventLog These should/will/might be implemented DailyRollingFileAppender - SMTPAppender - Log::Dispatch::Email::MailSender These might be implemented but they don't have corresponding classes in Log::Dispatch (yet): NullAppender TelnetAppender These might be simulated LF5Appender - use Tk? ExternallyRolledFileAppender - catch a HUP instead? These will probably not be implemented AsyncAppender JMSAppender SocketAppender - (ships a serialized LoggingEvent to the server side) SocketHubAppender ROLL YOUR OWN
Let's say you've in a mixed Java/Perl enviroment and you've come up with some custom Java appender with behavior you want to use in both worlds, "myorg.customAppender". You write a Perl appender with the same behavior "Myorg::CustomAppender". You want to use one config file accross both applications, so the config file will have to say 'myorg.customAppender'. But the mapping from "myorg.customAppender" to "Myorg::CustomAppender" isn't in this JavaMap class, so what do you do? In your Perl code, before you call Log::Log4perl::init(), do this: $Log::Log4perl::JavaMap::user_defined{'myorg.customAppender'} = 'Myorg::CustomAppender'; and you can use 'myorg.customAppender' in your config file with impunity. SEE ALSO
http://jakarta.apache.org/log4j/docs/ COPYRIGHT AND LICENSE
Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.1 2010-02-07 JavaMap(3)
All times are GMT -4. The time now is 01:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy