• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WARN level is not working

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a strange problem.If the level="debug",everything is fine(xml configuration file).
If level is changed to WARN,logging is stopped.It just logs one message and then just stops logging any further messages.

Can any body suggest me ways for troubleshooting the problem.What are the things i can check in this case?

thanks,
ajse
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats what the WARN level is supposed to do. It will suppress all logs which are lesser than the WARN level. Since your debug and info level messages are lesser than the WARN level, they will not show up in the logs.
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran,
Thanks for your time.But my problem is that after one WARN level log message ,no further WARN level logs are being logged into the log file.
I mean to say that logging is stopped after one WARN level message.
I dont know where to look for the solution.
But everything is working fine for DEBUG level.

regards,
ajse
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ajse roy:
But my problem is that after one WARN level log message ,no further WARN level logs are being logged into the log file.



Are there any other log messages being logged in your application with level higher than or equal to WARN level. If so, can you post the code where you logging them.
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I forgot to mention that if the LEVEL is WARN then the catalina.out also contains these one or two WARN messages before the logging is completely stopped.If the level is DEBUG then there is no log messages in catalina.out and only my log file contains these log messages.
Is there any chance that tomcat logging is somehow colliding with application logging?
thanks,
ajse
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have only one application in my webapps folder and only one log4j.xml.
The root logger has level WARN and one package logger has level WARN.There are no other levels specified in the log4j.
regards,
ajse
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ajse roy:
the logging is completely stopped.



I havent completely understood your question. What do you mean by logging is completely stopped.

1) Do you mean that you are not seeing messages logged using logger.debug() or logger.info(), when the level is set to WARN

or

2) Do you mean that if you are having 2 messages being logged using logger.warn() then you are seeing just the first one
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi jaikiran,
After two WARN messages,there are no further WARN messages.I am taking about the log file in production.
Let me make it clear....previously there were many WARN level messages in a fixed interval of time but now because of the issue the log file just shows two WARN messages and then no further messages in the same interval of time.
i.e logger.warn() is not working after putting two messages.
regards,
ajse
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, i now get what you are saying We would need some more information to figure out what's causing this. Could you post the log4j.xml file that you are using. Also some part of the code where you are instantiating the logger and then logging these logger.warn messages.
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran,
i am posting two xml files.I dont have src code with me.
The following file is working fine ....its in debug level for a package

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="All" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="stdout"/>
<appender-ref ref="file"/>
</appender>
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="warn"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ISO8601} | %-5p | %-25.25t | %-50.50c | %m%n"/>
</layout>
</appender>
<appender name="file" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/opt/app/tomcat/logs/mylog.txt" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="debug"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ISO8601} | %-5p | %-25.25t | %-50.50c | %m%n"/>
</layout>
</appender>
<logger name="com.company.lvl.ter">
<level value="debug" />
</logger>
<root>
<priority value="warn"/>
<appender-ref ref="All"/>
</root>
</log4j:configuration>

But the following file which is in warn level for the package does not....

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="All" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="stdout"/>
<appender-ref ref="file"/>
</appender>
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="warn"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ISO8601} | %-5p | %-25.25t | %-50.50c | %m%n"/>
</layout>
</appender>
<appender name="file" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/opt/app/tomcat/logs/mylog.txt" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="info"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ISO8601} | %-5p | %-25.25t | %-50.50c | %m%n"/>
</layout>
</appender>
<logger name="com.company.lvl.ter">
<level value="warn" />
</logger>
<root>
<priority value="warn"/>
<appender-ref ref="All"/>
</root>
</log4j:configuration>

Can it be some corrupt jar/library problem?

regards,
ajse
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
i forgot to mention.If the level is WARN then DailyRollingFileAppender is not creating new files i.e for three days same log file is there and if the level is DEBUG then everything is fine.
regards,
ajse
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try adding the BufferSize to your appender configuration as follows:



I am just taking a guess here. You are using the AsyncAppender which appends (sends log events) asynchronously. By default the BufferSize is 128, which means the log messages will be written after 128 log events. The reason why its working for DEBUG might have to do with the fact there the frequency of debug logs might be higher compared to the warn messages. Again, i havent used AsyncAppender and this is just a guess that i am taking based on its javadoc. If this works, you will then have to decide whats a good value for the BufferSize.
 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No success Jaikiran......its very strange issue.It was working well previously.But somehow from the last week its having the issue with warn level although debug level is still working fine.

Thanks for your time and effort.

regards,
ajse
 
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic