You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by chris derham <ch...@derham.me.uk> on 2011/05/27 13:26:32 UTC

Log4j.properties settings in documentation

All,

I think that I have found a problem in the documentation for setting up
log4j.properties at
http://tomcat.apache.org/tomcat-7.0-doc/logging.html#Using_Log4j. The same
text is on the tomcat 6.0 documentation. It specifies

log4j.appender.CATALINA.conversionPattern = %d [%t] %-5p %c- %m%n

When I run that I receive the following exception

log4j:ERROR Could not find value for key log4j.appender.CATALINA.layout
log4j:WARN No such property [conversionPattern] in
org.apache.log4j.DailyRollingFileAppender.
log4j:ERROR No layout set for the appender named [CATALINA].

It works fine if I update the setting to

log4j.appender.CATALINA.layout.conversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.CATALINA.layout=org.apache.log4j.PatternLayout

The same issue is present for catalina, localhost, manager, host-manager and
console appenders.

Is this something that I am doing wrong, or is the documentation wrong?

Chris

P.S. assuming that the documentation is wrong, does everybody stick with
juli logging? I mean if this has been wrong since v6, nobody can be using it
right? I guess juli logging provides everything most people need?

Re: Log4j.properties settings in documentation

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

Chris,

On 5/27/2011 7:26 AM, chris derham wrote:
> I think that I have found a problem in the documentation for setting up
> log4j.properties at
> http://tomcat.apache.org/tomcat-7.0-doc/logging.html#Using_Log4j.
>
> [snip]
>
> It works fine if I update the setting to
> log4j.appender.CATALINA.layout=org.apache.log4j.PatternLayout

You're right: it's an oversight.

> The same issue is present for catalina, localhost, manager, host-manager and
> console appenders.
>
> Is this something that I am doing wrong, or is the documentation wrong?

Fixed in 6.0 and 7.0 trunk. These should be included in the next
releases of each line. Thanks for the report.

> P.S. assuming that the documentation is wrong, does everybody stick with
> juli logging? I mean if this has been wrong since v6, nobody can be using it
> right?

It's possible that some defaults have changed in log4j or something like
that, and the problem is only now manifesting itself. But I think that
very few people re-configure Tomcat to use log4j logging for the
internal stuff.

> I guess juli logging provides everything most people need?

I think most people stick with JULI logging because:

 a) it's the default
 b) it meets most people's needs
 c) configuring logging in general is confusing and tedious

log4j, of course, provides lots of stuff that JULI cannot do (log to
syslog, log to SMTP, log to JDBC, etc.), but that most people don't
really care to do.

On all our projects, we use log4j for application logging but have never
bothered to configure Tomcat to use log4j because it's just not necessary.

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

iEYEARECAAYFAk3lQr8ACgkQ9CaO5/Lv0PBQvgCdHGEXc6LESDNIkiQDTDubQMe4
QIoAn2dhVpQr1Fm+xHHBLI9OfEtCLRZH
=KYcE
-----END PGP SIGNATURE-----

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