tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Understanding how to controlling what data is written to log4j appenders
Date Fri, 04 Dec 2015 00:53:54 GMT
2015-12-04 2:05 GMT+03:00 Joleen Barker <oldenuf2nobtr@gmail.com>:
> I want to have more control over what data is written to the various
> appenders in the log4j.properties files. I have played around with the
> various configurations in the log4j.properties file but I am not
> understanding how they are working in order to grasp how to have more
> control. I don't know if it would be a matter of turning off the INFO
> setting for the log4j.rootLogger and somehow setting individual logging for
> each appender.
>
> Below is my environment details:
> 1) The tomcat version that is running is v8.0.26.0
> 2) The OS is a Centos v7 UNIX VM
> 3) Java JDK I have installed that Tomcat is using is 1.8.0_60
> 4) Due to the catalina.out file growing too large with the default
> juli.AsyncFileHandler using the logging.properties file that was found in
> the $CATALINA_HOME/conf directory. I changed the settings on a vendors
> software to use the log4j logging instead. (So this is NOT my web
> application or product written by me.)

None of AsyncFileHandler is responsible for catalina.out.

The catalina.out file consumes output of ConsoleHandler.

>
> log4j;logger.org.apache.catalina.core,ContainerBase.[Catalina].[localhost].[/cfcc]=INFO,
CFCC
>

The above line has a typo. s/;/./ after "log4j"

> <...>


You need to set "additivity" flag for non-root loggers to false.
I have not tested, but I think it will be like this:


log4j.additivity.org.apache.catalina.core,ContainerBase.[Catalina].[localhost].[/cfcc]=false
log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=false
log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]=false
log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager]=false



Documentation for Log4j 1.x:
[1] http://logging.apache.org/log4j/1.2/

Guide:
[2] http://logging.apache.org/log4j/1.2/manual.html

Syntax of log4j.properties file:
[3] http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html#doConfigure%28java.lang.String,%20org.apache.log4j.spi.LoggerRepository%29

Best regards,
Konstantin Kolinko

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


Mime
View raw message