-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joleen,

On 3/7/16 12:31 PM, Joleen Barker wrote:
> The only thing I can think of to help you understand where I am at
> is to post the different log4j.properties config files I have. So I
> will post the one I have that went in for my default Tomcat
> messages and is working fine.

Perfect.

> Updated log4j.properties file I now use in my CATALINA/lib
> directory and is my base of my understanding for the changes I made
> to the Vendor's log4j.properties file.
> 
> My appender that rolls daily is CFCC and is getting most of what
> was in the catalina.out log originally (this one I was happy
> with):
> 
> log4j.rootLogger = INFO, CATALINA

This one looks fine.

<snip>

> Below this line is the Vendor's original one that was in the 
> <WEB-INF>/classes directory ( I also removed their
> log4j-1.2.8-1.jar that was in the <WEB-INF>/lib directory folder as
> it was older than the one I was using that is log4j-1.2.17.jar):

<snip> (most of this is boring)

> # Set root logger level to ERROR and its only appender to stdout. 
> log4j.rootLogger=ERROR, stdout

Interesting, but only until:

<snip>

> # stdout is set to be a ConsoleAppender. 
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender

This is what is killing you, plus everything that looks like this:

log4j.logger.com.proginet.sift.struts=${cfi.struts.logging.level}, stdou
t


Everything that says log4j.logger.[something]=[level], stdout

Is going to send those log messages to the "stdout" appender, which is
tied to System.out. You'll need to do one of two things to dig
yourself out:

1. Use swallowOutput="true" on your <Context>, which performs some
magic to take System.out from applications' calls and redirect it
elsewhere else (to the tomcat-defined loggers that can be configured
in Tomcat's log4j.properties file).

2. Change the "stdout" appender to be something other than
ConsoleAppender, and point it at a file on the disk.

I'm not a fan of the first option, but it's sometimes the quickest way
to handle everything all at once, and usually doesn't require any
changes to the application's configuration.

> Below this line is my updated vendor log4j.properties file (I
> really just added my CFCC appender information and changed anything
> that read to use "stdout"  since the log4j.rootLogger was set to
> that to  "CFCC" and then moved any logger and additivity to the
> bottom of the file. But I'm thinking I may need to give the Tomcat
> log4j CFCC appender a different file name to separate the
> application log information from Tomcats log4j output that gets
> written to the CFCC appender now. I also don't know what happens
> to the rollover if the two arr referencing the same file name. I
> was thinking it may roll over twice of something. What do you
> think, can they both use the same one? I was trying to make it
> similar to what happens in the product by default.)
> 
> 
> # Set root logger level to ERROR and its only appender to stdout. 
> log4j.rootLogger=ERROR, CFCC
> 
> log4j.appender.CFCC = org.apache.log4j.DailyRollingFileAppender

That should probably work.

But if you removed log4j.jar from the application, only the global
log4j.properties file will be read. It's okay to have log4j.jar in the
bin/ directory as well as your webapp's WEB-INF/lib directory. The
former will run/configure Tomcat's logging, and the latter will
run/configure the application's logging. In fact, if the application
initializes log4j itself (usually by creating a new
PropertyConfigurator object), then weird things can happen with the
application re-defining the global configuration for Tomcat.

I'd recommend having two .jar files and two .properties files, just to
be safe.

> # stdout is set to be a ConsoleAppender. 
> log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender 
> log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout 
> log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [%t]
> %-5p %c %x - %m%n

The comment is wrong; the ConsuleAppender is called CONSOLE, not stdout.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlbe8zIACgkQ9CaO5/Lv0PD6/gCfabK0eTyRhBgC/cNDj8fAV3L0
1csAniZXE2j9DPzqYg2vPEGs+KwzNegn
=PKZ3
-----END PGP SIGNATURE-----

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

Reply via email to