Hi,
I'm having difficulties to configure log4j with tomcat logging per context.
Here's what I have done:
1. I've added log4j.jar to the bin dir
2. I've created a log4j.xml in common/classes and added the log4j.dtd
This seems to work, because when I add a debug logger for org.apache,
I get a lot of extra logging lines in stdout.log.
But now I have a new webapp called advertisements and this is de
message that I get in de stdout.log:
log4j:WARN No appenders could be found for logger
(org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/advertisements]).
log4j:WARN Please initialize the log4j system properly.
But when I add the logger with this name I get the following error:
log4j:ERROR Parsing error on line 10 and column 100
log4j:ERROR Attribute value
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/advertisements]
of type ID must be a name.
So I guess log4j can't handle these names?
I've also tried to use a log4j.properties (which also works when I add
a debug logger for org.apache), but that doesn't work either, but this
time I only get the first warning.
My log4j.xml:
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd
log4j:configuration
!-- STDOUT: Outputs log information to the standard output/console --
appender name=STDOUT class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=%d %-5p - %m%n/
/layout
/appender
logger
name=org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/advertisements]
level value=DEBUG/
appender-ref ref=STDOUT/
/logger
logger name=org.apache
level value=INFO/
appender-ref ref=STDOUT/
/logger
root
level value=ERROR/
/root
/log4j:configuration
alternative log4j.properties:
log4j.rootLogger=ERROR, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
#log4j.logger.org.apache=DEBUG,A1
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/advertisements]=INFO,A1
Regards,
Wouter de Vaal
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]