Joleen

>-----Original Message-----
>From: Joleen Barker [mailto:oldenuf2no...@gmail.com] 
>Sent: Monday, March 07, 2016 3:54 PM
>To: Tomcat Users List
>Subject: Re: Understanding how to controlling what data is written to log4j 
>appenders
>
>One more thing I tried was to change the parent for the rootlogger from CFCC 
>to be CONSOLE to attempt to make it to where my log was not the parent and it 
>still didn't change it. I am getting 0 messages in my cfcc log and everything 
>still going to catalina.out.
>
>I know I'm sooooo close to figuring out what little setting I am missing.
>
>
>
>On Mon, Mar 7, 2016 at 2:07 PM, Joleen Barker <oldenuf2no...@gmail.com>
>wrote:
>
>> There is a comment that says:
>>
>> #stdout is set to be a ConsoleAppender
>>
>> But I changed the "stdout" that was set as the parent to CFCC so I 
>> thought then everything would go to the parent but I don't receive any of 
>> the logs.
>> My cfcc log is just about empty except for the startup details. So I 
>> went ahead and changed the CATALINABASE/lib log4j.properties file name 
>> appender CFCC to go to a file named tomcat instead so I could 
>> differentiate between the application logs and the tomcat logs.
>>
>> Now I get the startup messages in a log called tomcat (this is fine) 
>> and not one message in my cfcc log. Even with my updated 
>> log4j.properties file sitting in the WEB-INF/classes directory so I 
>> must have something configured wrong that they are all still going to 
>> the standard Stdout/Stderr.
>>
>>
>>
>> On Mon, Mar 7, 2016 at 12:54 PM, Joleen Barker 
>> <oldenuf2no...@gmail.com>
>> wrote:
>>
>>> 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):

[SNIP]

>>>> 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.)

[SNIP]

>>>> I know, it's a lot to look at. Thank you for the help.

Exactly what messages are in the default Tomcat logs that are not making it 
into the log4j logs?

As I am new to log4j, I am somewhat intimidated by your configuration, and am 
not sure how much more helpful I can be.  :-)

However, if I were in your shoes, I would try a systematic approach in 
experimentation.  I would comment out everything in all the log configurations. 
 Then, one at a time, uncomment one logger and one appender, restart the 
container, and see how the logs behave.  If that one piece of the configuration 
does not work, then tweak it and retry.  Once that portion works, then I would 
move onto the next logger and appender and repeat.

To sum up, if the configuration is complex, simplify it.  Once the simple 
configuration works, then adjust to handle a more advanced setup.

>>>> -Joleen
>>>>
>>>> On Fri, Mar 4, 2016 at 4:33 PM, Cris Berneburg - US 
>>>> > 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