I forgot to tell Chuck that the swallowOutput parm is set to true in the
context. When you see the vendor's log4j.properties you will see why there
were so many messages still going to the catalina.out due to them using
stdout.

-Joleen

On Mon, Mar 7, 2016 at 12:31 PM, Joleen Barker <oldenuf2no...@gmail.com>
wrote:

> Hello Christopher, Charles, and Cris,
>
> Thank you for all the responses. Thank you for the encouragement. I dusted
> off my pants and went back at it. I made changes to the Vendors
> log4j.properties file. When I really looked at it I was able to determine
> they were things I was familiar with and the layout was just throwing me
> off so I moved things around so the layout was similar to the default
> log4j.properties I had. So I think I am getting this a lot more. However,
> there are still some messages going to the catalina.out. I think this will
> answer Chucks question as to if the product was really using log4j.
>
> 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.
>
> 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
>
> # Define all the appenders
> log4j.appender.CATALINA = org.apache.log4j.DailyRollingFileAppender
> log4j.appender.CATALINA.File = ${catalina.base}/logs/catalina
> log4j.appender.CATALINA.Append = true
> log4j.appender.CATALINA.Encoding = UTF-8
> log4j.appender.CATALINA.DatePattern = '.'yyyy-MM-dd'.log'
> log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
> log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
>
> log4j.appender.CFCC = org.apache.log4j.DailyRollingFileAppender
> log4j.appender.CFCC.File = ${catalina.base}/logs/cfcc
> log4j.appender.CFCC.Append = true
> log4j.appender.CFCC.Encoding = UTF-8
> log4j.appender.CFCC.DatePattern = '.'yyyy-MM-dd'.log'
> log4j.appender.CFCC.layout = org.apache.log4j.PatternLayout
> log4j.appender.CFCC.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
>
> log4j.appender.LOCALHOST = org.apache.log4j.DailyRollingFileAppender
> log4j.appender.LOCALHOST.File = ${catalina.base}/logs/localhost
> log4j.appender.LOCALHOST.Append = true
> log4j.appender.LOCALHOST.Encoding = UTF-8
> log4j.appender.LOCALHOST.DatePattern = '.'yyyy-MM-dd'.log'
> log4j.appender.LOCALHOST.layout = org.apache.log4j.PatternLayout
> log4j.appender.LOCALHOST.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
>
> log4j.appender.MANAGER = org.apache.log4j.DailyRollingFileAppender
> log4j.appender.MANAGER.File = ${catalina.base}/logs/manager
> log4j.appender.MANAGER.Append = true
> log4j.appender.MANAGER.Encoding = UTF-8
> log4j.appender.MANAGER.DatePattern = '.'yyyy-MM-dd'.log'
> log4j.appender.MANAGER.layout = org.apache.log4j.PatternLayout
> log4j.appender.MANAGER.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
>
> log4j.appender.HOST-MANAGER = org.apache.log4j.DailyRollingFileAppender
> log4j.appender.HOST-MANAGER.File = ${catalina.base}/logs/host-manager
> log4j.appender.HOST-MANAGER.Append = true
> log4j.appender.HOST-MANAGER.Encoding = UTF-8
> log4j.appender.HOST-MANAGER.DatePattern = '.'yyyy-MM-dd'.log'
> log4j.appender.HOST-MANAGER.layout = org.apache.log4j.PatternLayout
> log4j.appender.HOST-MANAGER.layout.ConversionPattern = %d [%t] %-5p %c-
> %m%n
>
> log4j.appender.CONSOLE = org.apache.log4j.ConsoleAppender
> log4j.appender.CONSOLE.Encoding = UTF-8
> log4j.appender.CONSOLE.layout = org.apache.log4j.PatternLayout
> log4j.appender.CONSOLE.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
>
> # Configure which loggers log to which appenders
> log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/cfcc]
> = INFO, CFCC
> 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
>
> # In order to prevent messages from being duplicated in the appenders the
> additivity flag is
> # needed to be set. What this does is prevent the child appenders from
> also sending their
> # messages to the parent appender which in our case is the CATALINA log.
> log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/cfcc]
> = FALSE
> log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]
> = FALSE
>
>
> 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):
>
> cfi.trace.dir=/usr/opt/vendor/mft/IS/logs/trace
>
> # Crystal Reports variables
> crystal.logs.home=${user.home}
>
> # Tradelink variables
> tradelink.logging.level=ERROR
>
> # HCF variables
> hcf.logging.level=ERROR
>
> # Optus variables
> optus.logging.level=ERROR
>
> # SSO variables
> sso.logging.level=ERROR
>
> # CFI variables
> cfi.struts.logging.level=ERROR
>
> # Set root logger level to ERROR and its only appender to stdout.
> log4j.rootLogger=ERROR, stdout
>
> # Set TradeLink logger level to ERROR and its only appender to daily
> rolling file.
> log4j.logger.comp.user=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.tp=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.doc=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.bpm=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.agent=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.audit=${tradelink.logging.level}, TradeLink
> log4j.logger.ArchiveAgent=${tradelink.logging.level}, TradeLink
> log4j.logger.util=${tradelink.logging.level}, TradeLink
> log4j.logger.lib=${tradelink.logging.level}, TradeLink
>
> # Covers all of the Crystal Reports reporting engine
> log4j.logger.com.crystaldecisions.reports=ERROR, jpeAppender
> log4j.logger.com.crystaldecisions.threedg=ERROR, jpeAppender
> log4j.logger.com.crystaldecisions.common=ERROR, jpeAppender
>
> # CFI Struts
> log4j.logger.com.proginet.sift.struts=${cfi.struts.logging.level}, stdout
> log4j.additivity.com.proginet.sift.struts=false
>
> # SSH trace
> log4j.logger.com.proginet.siftssh=ERROR, stdout
> log4j.additivity.com.proginet.siftssh=false
> log4j.logger.com.proginet.siftftp.cert=ERROR, stdout
> log4j.additivity.com.proginet.siftftp.cert=false
> log4j.logger.com.maverick=ERROR, stdout
> log4j.additivity.com.maverick=false
> log4j.logger.com.sshtools=ERROR, stdout
> log4j.additivity.com.sshtools=false
>
> # HCF
> log4j.logger.com.proginet.sift.hcf=${hcf.logging.level}, stdout
> log4j.additivity.com.proginet.sift.hcf=false
>
> # Optus
> log4j.logger.com.proginet.sift.optus=${optus.logging.level}, stdout
> log4j.additivity.com.proginet.sift.optus=false
>
> # SSO
> log4j.logger.com.proginet.sift.sso=${sso.logging.level}, stdout
> log4j.additivity.com.proginet.sift.sso=false
>
> # TradeLink will only write to file
> log4j.additivity.comp.user=false
> log4j.additivity.comp.tp=false
> log4j.additivity.comp.doc=false
> log4j.additivity.comp.bpm=false
> log4j.additivity.comp.agent=false
> log4j.additivity.comp.audit=false
> log4j.additivity.ArchiveAgent=false
> log4j.additivity.util=false
> log4j.additivity.lib=false
>
> # stdout is set to be a ConsoleAppender.
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>
> # stdout uses PatternLayout.
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c %x
> - %m%n
>
> # TradeLink is set to be a DailyRollingFileAppender.
> log4j.appender.TradeLink=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.TradeLink.ImmediateFlush=true
> log4j.appender.TradeLink.File=${cfi.trace.dir}/openbpm.html
> log4j.appender.TradeLink.Append=true
> log4j.appender.TradeLink.DatePattern='.'yyyy-MM-dd
>
> # TradeLink uses HTMLLayout.
> log4j.appender.TradeLink.layout=org.apache.log4j.HTMLLayout
> log4j.appender.TradeLink.layout.ConversionPattern=%d{ISO8601} %-5p %c %m%n
> log4j.appender.TradeLink.layout.Title=TradeLink
>
> # Crystal Reports is set to be a RollingFileAppender.
> log4j.appender.jpeAppender=org.apache.log4j.RollingFileAppender
> log4j.appender.jpeAppender.file=${crystal.logs.home}/jpe.log
> log4j.appender.jpeAppender.ImmediateFlush=false
> # number of log files to keep before deleting the oldest one
> log4j.appender.jpeAppender.MaxBackupIndex=30
> log4j.appender.jpeAppender.MaxFileSize=500KB
>
> # Crystal Reports Log message layout: date-time [thread] priority category
> - message lineTerminator
> log4j.appender.jpeAppender.layout=org.apache.log4j.PatternLayout
> log4j.appender.jpeAppender.layout.ConversionPattern=%d{dd MMM yyyy
> HH:mm:ss} [%t] %-5p %c - %m%n
>
> # RADIUS
> log4j.logger.com.proginet.sift.login.RADIUSAuthMethod=ERROR, RADIUSFile
> log4j.appender.RADIUSFile.File=${cfi.trace.dir}/RADIUS-trace.txt
> log4j.appender.RADIUSFile=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.RADIUSFile.ImmediateFlush=true
> log4j.appender.RADIUSFile.Append=true
> log4j.appender.RADIUSFile.DatePattern='-'yyyy-MM-dd
> log4j.appender.RADIUSFile.layout=org.apache.log4j.PatternLayout
> log4j.appender.RADIUSFile.layout.ConversionPattern=%d{dd MMM yyyy
> HH:mm:ss} [%t] %-5p %c - %m%n
>
>
> 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.)
>
>
> cfi.trace.dir=/usr/opt/vendor/mft/IS/logs/trace
>
> # Crystal Reports variables
> crystal.logs.home=${user.home}
>
> # Tradelink variables
> tradelink.logging.level=ERROR
>
> # HCF variables
> hcf.logging.level=ERROR
>
> # Optus variables
> optus.logging.level=ERROR
>
> # SSO variables
> sso.logging.level=ERROR
>
> # CFI variables
> cfi.struts.logging.level=ERROR
>
> # Set root logger level to ERROR and its only appender to stdout.
> log4j.rootLogger=ERROR, CFCC
>
> log4j.appender.CFCC = org.apache.log4j.DailyRollingFileAppender
> log4j.appender.CFCC.File = ${catalina.base}/logs/cfcc
> log4j.appender.CFCC.Append = true
> log4j.appender.CFCC.Encoding = UTF-8
> log4j.appender.CFCC.DatePattern = '.'yyyy-MM-dd'.log'
> log4j.appender.CFCC.layout = org.apache.log4j.PatternLayout
> log4j.appender.CFCC.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
>
> # 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
>
> # TradeLink is set to be a DailyRollingFileAppender.
> log4j.appender.TradeLink=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.TradeLink.File=${cfi.trace.dir}/openbpm.html
> log4j.appender.TradeLink.Append=true
> log4j.appender.TradeLink.ImmediateFlush=true
> log4j.appender.TradeLink.DatePattern='.'yyyy-MM-dd
> log4j.appender.TradeLink.layout.Title=TradeLink
> log4j.appender.TradeLink.layout=org.apache.log4j.HTMLLayout
> log4j.appender.TradeLink.layout.ConversionPattern=%d{ISO8601} %-5p %c %m%n
>
> # Crystal Reports is set to be a RollingFileAppender.
> log4j.appender.jpeAppender=org.apache.log4j.RollingFileAppender
> log4j.appender.jpeAppender.file=${crystal.logs.home}/jpe.log
> log4j.appender.jpeAppender.ImmediateFlush=false
> log4j.appender.jpeAppender.MaxBackupIndex=30
> log4j.appender.jpeAppender.MaxFileSize=500KB
> log4j.appender.jpeAppender.layout=org.apache.log4j.PatternLayout
> log4j.appender.jpeAppender.layout.ConversionPattern=%d{dd MMM yyyy
> HH:mm:ss} [%t] %-5p %c - %m%n
>
> # RADIUS
> log4j.logger.com.proginet.sift.login.RADIUSAuthMethod=ERROR, RADIUSFile
> log4j.appender.RADIUSFile=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.RADIUSFile.File=${cfi.trace.dir}/RADIUS-trace.txt
> log4j.appender.RADIUSFile.Append=true
> log4j.appender.RADIUSFile.ImmediateFlush=true
> log4j.appender.RADIUSFile.DatePattern='-'yyyy-MM-dd
> log4j.appender.RADIUSFile.layout=org.apache.log4j.PatternLayout
> log4j.appender.RADIUSFile.layout.ConversionPattern=%d{dd MMM yyyy
> HH:mm:ss} [%t] %-5p %c - %m%n
>
> # Configure which loggers log to which appenders
> log4j.logger.comp.user=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.tp=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.doc=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.bpm=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.agent=${tradelink.logging.level}, TradeLink
> log4j.logger.comp.audit=${tradelink.logging.level}, TradeLink
> log4j.logger.ArchiveAgent=${tradelink.logging.level}, TradeLink
> log4j.logger.util=${tradelink.logging.level}, TradeLink
> log4j.logger.lib=${tradelink.logging.level}, TradeLink
> log4j.logger.com.crystaldecisions.reports=ERROR, jpeAppender
> log4j.logger.com.crystaldecisions.threedg=ERROR, jpeAppender
> log4j.logger.com.crystaldecisions.common=ERROR, jpeAppender
> log4j.logger.com.proginet.sift.struts=${cfi.struts.logging.level}, CFCC
> log4j.logger.com.proginet.siftssh=ERROR, CFCC
> log4j.logger.com.proginet.siftftp.cert=ERROR, CFCC
> log4j.logger.com.maverick=ERROR, CFCC
> log4j.logger.com.sshtools=ERROR, CFCC
> log4j.logger.com.proginet.sift.hcf=${hcf.logging.level}, CFCC
> log4j.logger.com.proginet.sift.optus=${optus.logging.level}, CFCC
> log4j.logger.com.proginet.sift.sso=${sso.logging.level}, CFCC
>
> # In order to prevent messages from being duplicated in the appenders the
> additivity flag is
> # needed to be set. What this does is prevent the child appenders from
> also sending their
> # messages to the parent appender which is the CFCC log.
> log4j.additivity.comp.user=false
> log4j.additivity.comp.tp=false
> log4j.additivity.comp.doc=false
> log4j.additivity.comp.bpm=false
> log4j.additivity.comp.agent=false
> log4j.additivity.comp.audit=false
> log4j.additivity.ArchiveAgent=false
> log4j.additivity.util=false
> log4j.additivity.lib=false
> log4j.additivity.com.proginet.sift.struts=false
> log4j.additivity.com.proginet.siftssh=false
> log4j.additivity.com.proginet.siftftp.cert=false
> log4j.additivity.com.maverick=false
> log4j.additivity.com.sshtools=false
> log4j.additivity.com.proginet.sift.hcf=false
> log4j.additivity.com.proginet.sift.optus=false
> log4j.additivity.com.proginet.sift.sso=false
>
>
> I know, it's a lot to look at. Thank you for the help.
>
> -Joleen
>
> On Fri, Mar 4, 2016 at 4:33 PM, Cris Berneburg - US <cberneb...@caci.com>
> wrote:
>
>> Hi Joleen
>>
>> -----Original Message-----
>> From: Joleen Barker [mailto:oldenuf2no...@gmail.com]
>> Sent: Thursday, March 03, 2016 11:23 PM
>> To: Tomcat Users List
>> Subject: Re: Understanding how to controlling what data is written to
>> log4j appenders
>>
>> > Hello,
>> >
>> > I don't know if I should use a new thread or not but this is a
>> continuation of this issue. I found that even after my changes there was
>> very little being written to my new log and there were still many of the
>> product messages being written to the catalina.out. It has now come to my
>> attention that the web application contains a log4j.jar file in the
>> <WEB-INF>/lib directory and a log4j.properties file in the
>> <WEB-INF>/classes directory.
>> > This log4j.properties file has a lot more items in it and I believe is
>> the reason all the messages from the product are still going to the
>> catalina.out log.
>> >
>> > Here I was so proud of myself for getting the logs to go to an appender
>> and the log rolling over as expected only to find the catalina.out still
>> growing with messages from the application.
>>
>> Hey, that's a good start!  I just completed refactoring our app to use
>> log4j2, and it was a challenge.  While I am new to using log4j, maybe we
>> can stumble thru your problem and solve it together.
>>
>> > I am unsure how to get these messages to be added to my log file that
>> is being used from the log4j.properties file that is in the
>> CATALINA_BASE/lib directory.
>> >
>> > One of the other things I noticed is the vendor has a tomcat-juli.jar
>> in the CATALINA_BASE/lib as well as in the CATALINA_BASE/bin directory
>> where it should be. Would the one that is in the CATALINA_BASE/lib
>> directory be doing anything. Maybe it is there in error and not really
>> effecting anything but I don't know.
>> >
>> > I did read in a note on the tomcat web page that gave the instructions
>> to use the log4j logging that the steps it had written were not needed if
>> you just want to use log4j in your own web application - in that case, you
>> would just put log4j and the log4j.properties in the WEB-INF/lib and the
>> WEB-INF/classes of your web application which it appears the vendor did. So
>> I think I would need to edit their log4j.properties file.
>> >
>> > Am I on the right track at all here?
>>
>> I would check a few things:
>>
>> 1. Check the container/application startup messages for autoconfig or
>> default config notifications.  This may be a moot point since you already
>> said "the logs to go to an appender and the log rolling over as expected".
>>
>> 2. Check the log4j config files:
>>   a. For appenders that go to Console or System_Out.
>>   b. That the logger(s) refer to the appender(s) you want.
>>   c. Check the logger(s) "level" to ensure the messages levesl are >=
>> that minimum threshold.
>>
>> 3. If you are in doubt as to which log4j config file is in use and have
>> the ability to experiment, try changing the config files (and restarting
>> the container?) to see how that affects the logs.  Often what I will do is
>> try to break something with invalid syntax - if that causes an error then I
>> know I am editing the correct file, but if no error is generated, then I
>> don't even have the correct file and know I should be looking elsewhere.
>>
>> 4. Check the application code to be sure it is not writing to System.out
>> or calling exception printStackTrace directly.
>>
>> 5. Is there an "adaptor" for connecting the Tomcat logging interface to
>> log4j that needs to be configured?  I did not use the logging interface
>> built into Tomcat, so I cannot provide help with that.
>>
>> > Would it be bad to post their log4j.properties along with mine to see
>> how I can edit it to have the info go to the new log?
>> >
>> > -Joleen
>> >
>> > On Fri, Dec 4, 2015 at 4:49 PM, Joleen Barker <oldenuf2no...@gmail.com>
>> > wrote:
>> >
>> >> Hello Chris,
>> >>
>> >> As of now I am not using JULI any longer. I am using the log4j
>> >> v1.2.17.jar
>> >>
>> >> Eventually I will jump in to the log4j v2 users and try my hand at
>> that.
>> >>
>> >> Thank you for the clarification on where to go for information. I
>> >> completely missed seeing the log4j mailing list. Could you send me the
>> >> url to signup for it.
>> >>
>> >> Have a wonderful weekend.
>> >>
>> >> -Joleen
>> >>
>> >>
>> >>
>> >> On Fri, Dec 4, 2015 at 1:11 PM, Christopher Schultz <
>> >> ch...@christopherschultz.net> wrote:
>> >>
>> >>> Joleen,
>> >>>
>> >>> On 12/3/15 11:55 PM, Joleen Barker wrote:
>> >>>> The information you gave me for the additivity was PERFECT! It did
>> >>> exactly
>> >>>> what I was looking for. This also really allowed me to understand
>> >>>> what processes were writing to which log. I have the settings in
>> >>>> place in my test environment now and if all goes well the changes
>> >>>> will be added in
>> >>> the
>> >>>> production environment soon.
>> >>>
>> >>> Glad you are making progress.
>> >>>
>> >>> There are many folks here who have experience with log4j (myself and,
>> >>> evidently, Konstantin as well), but for more thorough log4j help,
>> >>> you're probably going to wait to go over to the log4j mailing list.
>> >>>
>> >>> If JULI is in the mix (the default logging framework for Tomcat) and
>> >>> you are using logging.properties, then you want to stay /here/ for
>> >>> those questions. Similarly, for configuration involving Tomcat's
>> >>> container-defined loggers ("categories" in older log4j-speak), here
>> >>> is also the best place to post.
>> >>>
>> >>> -chris
>> >>>
>>
>> --
>> Cris Berneburg, Lead Software Engineer, CACI
>>
>>
>

Reply via email to