You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Timothy Lam <ma...@yahoo.com> on 2010/11/09 19:48:34 UTC

Tomcat log files

I'm trying to clean up Tomcat logging to use log4j.  I've read the Tomcat logging guide that comes with my version of Tomcat 6.0.28.  I'm really confused with all the different log files that are being generated in the default Tomcat before log4j configuration.  Why are there so many different log files: admin, manager, localhost, manager, host-manager, catalina log files and then System.out and System.err get appended to catalina.out?  What's the purpose of each of these log files?  When I configure log4j in tomcat I will have this single tomcat.log file but will that contain everything in the default log files that I previously listed in addition to catalina.out?  Or will I need to use both tomcat.log and catalina.out to get a full picture of all of my logging?  I tried to delete the logging.properties file in my Tomcat 6.0.28 and I get a NoClassDefFoundException in doing so.  So there doesn't seem to be any way of really removing java.util.logging
from Tomcat in v6.0.28.



      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat log files

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Timothy,

My CONSOLE appender was foolishly configured.

On 11/9/2010 4:35 PM, Christopher Schultz wrote:
> log4j.appender.CONSOLE=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.CONSOLE.file=${catalina.base}/logs/.
> log4j.appender.CONSOLE.encoding=UTF-8
> log4j.appender.CONSOLE.DatePattern='.'yyyy-MM-dd'.log'
> log4j.appender.CONSOLE.conversionPattern = %d [%t] %-5p %c- %m%n
> log4j.appender.CONSOLE.append=true

It should be:

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.encoding=UTF-8
log4j.appender.CONSOLE.conversionPattern = %d [%t] %-5p %c- %m%n

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzZyGAACgkQ9CaO5/Lv0PCyGgCgvuGt1v7U86qbp4r7FwiGFHQd
89wAoKc42YxmIS7sDgPKVvDbSvHTvxZT
=6tMF
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat log files

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Timothy,

On 11/9/2010 4:06 PM, Christopher Schultz wrote:
> I'm not sure why the documentation doesn't show an equivalent
> configuration for log4j. Maybe I'll write one and submit it for inclusion.

Without testing it, I've written this log4j configuration which should
be equivalent to the default one that ships with Tomcat. I apologize in
advance for any line-wrapping problems which may arise from my emailer.

log4j.rootLogger=DEBUG, CATALINA

# Define all the appenders
log4j.appender.CATALINA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.CATALINA.file=${catalina.base}/logs/catalina.
log4j.appender.CATALINA.encoding=UTF-8
# Roll-over the log once per day
log4j.appender.CATALINA.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.CATALINA.conversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.CATALINA.append=true

log4j.appender.LOCALHOST=org.apache.log4j.DailyRollingFileAppender
log4j.appender.LOCALHOST.file=${catalina.base}/logs/localhost.
log4j.appender.LOCALHOST.encoding=UTF-8
log4j.appender.LOCALHOST.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.LOCALHOST.conversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.LOCALHOST.append=true

log4j.appender.MANAGER=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MANAGER.file=${catalina.base}/logs/manager.
log4j.appender.MANAGER.encoding=UTF-8
log4j.appender.MANAGER.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.MANAGER.conversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.MANAGER.append=true

log4j.appender.HOST-MANAGER=org.apache.log4j.DailyRollingFileAppender
log4j.appender.HOST-MANAGER.file=${catalina.base}/logs/host-manager.
log4j.appender.HOST-MANAGER.encoding=UTF-8
log4j.appender.HOST-MANAGER.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.HOST-MANAGER.conversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.HOST-MANAGER.append=true

log4j.appender.CONSOLE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.CONSOLE.file=${catalina.base}/logs/.
log4j.appender.CONSOLE.encoding=UTF-8
log4j.appender.CONSOLE.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.CONSOLE.conversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.CONSOLE.append=true

# Configure which loggers log to which appenders
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO,
LOCALHOST
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]=INFO,
MANAGER
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager]=INFO,
HOST-MANAGER
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzZvqoACgkQ9CaO5/Lv0PBweACcC8nkWamXXjXCRgGjoHUtVpBY
iBYAoInaalGQ+H+Zbcmg/QIxfFrTGa47
=/vyy
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat log files

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tobias,

On 11/15/2010 10:43 AM, Tobias Crefeld wrote:
> Am Tue, 09 Nov 2010 16:06:14 -0500
> schrieb Christopher Schultz <ch...@christopherschultz.net>:
> 
>> Have you correctly replaced lib/tomcat-juli.jar
>> and installed lib/tomcat-juli-adapters.jar? If not, you may be falling
>> back to the old logger which requires logging.properties.
> 
> For whatever-reason and different than tomcat-juli-adapters.jar the
> default location of tomcat-juli.jar is "bin/", not "lib/". 

Thanks for pointing that out. I had been reading the docs and didn't
notice that they were different tomcat-juli.jar goes into bin/ while
tomcat-juli-adapters.jar goes into lib/).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzjAsIACgkQ9CaO5/Lv0PASzgCfVInqw5ASMbCoTGrLgFc2pcgS
5YMAn3S2YhSNRY/+9Rped7kixFOwdnnb
=lPVN
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat log files

Posted by Tobias Crefeld <tc...@cataneo.eu>.
Am Tue, 09 Nov 2010 16:06:14 -0500
schrieb Christopher Schultz <ch...@christopherschultz.net>:

> Have you correctly replaced lib/tomcat-juli.jar
> and installed lib/tomcat-juli-adapters.jar? If not, you may be falling
> back to the old logger which requires logging.properties.

For whatever-reason and different than tomcat-juli-adapters.jar the
default location of tomcat-juli.jar is "bin/", not "lib/". 


Regards,
 Tobias.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat log files

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Timothy,

On 11/9/2010 1:48 PM, Timothy Lam wrote:
> I'm trying to clean up Tomcat logging to use log4j.  I've read the
> Tomcat logging guide that comes with my version of Tomcat 6.0.28.

Excellent.

> I'm really confused with all the different log files that are being 
> generated in the default Tomcat before log4j configuration.  Why are 
> there so many different log files: admin, manager, localhost, 
> manager, host-manager, catalina log files and then System.out and 
> System.err get appended to catalina.out? What's the purpose of each 
> of these log files?

So, the log files for "admin", "manager", and "host-manager" are
application-specific log files. Anything the application sends to
ServletContext.log() will go to these files. The "localhost" log is for
anything emitted by the <Host name="localhost"> and catalina.out is
exclusively for stdout and stderr, and is done via shell redirection (so
you shouldn't see any configuration for it anywhere other than
bin/catalina.sh).

All of these are configured in conf/logging.properties, though they may
not have a ton of explanation as to /why/ they are configured the way
they are. You are free to change any of this configuration -- for
instance, to remove the manager, host-manager, and admin log files. I
would recommend not deploying any unused webapps, and enabling logging
for any webapps you actually do use.

> When I configure log4j in tomcat I will have
> this single tomcat.log file but will that contain everything in the
> default log files that I previously listed in addition to
> catalina.out?

It should.

- From the docs:

"
You can (and should) be more picky about which packages to include in
the logging. Tomcat defines loggers by Engine and Host names. For
example, for a more detailed Catalina localhost log, add this to the end
of the log4j.properties above. Note that there are known issues with
using this naming convention (with square brackets) in log4j XML based
configuration files, so we recommend you use a properties file as
described until a future version of log4j allows this convention.


log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=DEBUG
  log4j.logger.org.apache.catalina.core=DEBUG
  log4j.logger.org.apache.catalina.session=DEBUG
"

If you read a bit more about log4j (not covered by the Tomcat docs, of
course), you'll find that you can set up logging for different
applications by using different appenders like this:

log4j.appender.LOCALHOST=org.apache.log4j.FileAppender
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=LOCALHOST

If you repeat this for each of the default loggers defined for the JULI
configuration (which you are replacing with log4j), you'll get the same
setup. I'm not sure why the documentation doesn't show an equivalent
configuration for log4j. Maybe I'll write one and submit it for inclusion.

> Or will I need to use both tomcat.log and catalina.out
> to get a full picture of all of my logging?

catalina.out will always include whatever goes to stdout/stderr: the use
of log4j won't change that.

> I tried to delete the
> logging.properties file in my Tomcat 6.0.28 and I get a
> NoClassDefFoundException in doing so.

logging.properties isn't supposed to be necessary, but I seem to recall
some issue with the shell scripts choking when logging wasn't completely
configured correctly. Have you correctly replaced lib/tomcat-juli.jar
and installed lib/tomcat-juli-adapters.jar? If not, you may be falling
back to the old logger which requires logging.properties.

> So there doesn't seem to be
> any way of really removing java.util.logging from Tomcat in v6.0.28.

Yes, it can be done. If it's still not working, please post your entire
log4j.properties and a directory listing of CATALINA_HOME/lib and
CATALINA_HOME/conf.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzZt8YACgkQ9CaO5/Lv0PBnSACgv0iBGYspjkELcUEMIUGLGUg6
paMAnRmYmi9lNydjZ/3Z2fMo4z2wcXiK
=T7Fb
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat log files

Posted by Mark Shifman <ma...@yale.edu>.
you need to look at
http://tomcat.apache.org/tomcat-6.0-doc/logging.html
and do what it says for log4j

On 11/09/2010 01:48 PM, Timothy Lam wrote:
> I'm trying to clean up Tomcat logging to use log4j.  I've read the Tomcat logging guide that comes with my version of Tomcat 6.0.28.  I'm really confused with all the different log files that are being generated in the default Tomcat before log4j configuration.  Why are there so many different log files: admin, manager, localhost, manager, host-manager, catalina log files and then System.out and System.err get appended to catalina.out?  What's the purpose of each of these log files?  When I configure log4j in tomcat I will have this single tomcat.log file but will that contain everything in the default log files that I previously listed in addition to catalina.out?  Or will I need to use both tomcat.log and catalina.out to get a full picture of all of my logging?  I tried to delete the logging.properties file in my Tomcat 6.0.28 and I get a NoClassDefFoundException in doing so.  So there doesn't seem to be any way of really removing java.util.logging
> from Tomcat in v6.0.28.
> 
> 
> 
>       
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

mas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org