Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-20-2008, 11:14 AM
Member
 
Join Date: Jun 2008
Posts: 6
ajaykumar_mohini is on a distinguished road
log4j log files are not getting rolled over
I am using log4j in my project the log files are not getting over after the stipulated size of the log file is reached.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-20-2008, 12:31 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,609
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Any exceptions you get? Or is it override after reach the specified file size?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-20-2008, 02:33 PM
Member
 
Join Date: Jun 2008
Posts: 6
ajaykumar_mohini is on a distinguished road
log4j logfiles are not getting rolled over
We have an application which uses log4j to log its log messages, we are using rolling file appender and the roll over size is 5MB.
Every thing runs fine when we have only one instance of this application running. The file gets rolled over after crossing 5MB.
We are facing a problem only when we start the same application two times (in two different JVMS). The log file does not get roll over even after crossing 5MB.

We have this problem as two log 4j instances ( running in different JVMS) are accessing the same file in parallel. The case might be that log 4j has a file pointer which is not refreshed when another instance of log 4j (running in different JVM) updates the same file.
Is there any way to refresh the PropertyConfigurator setting.

Last edited by ajaykumar_mohini : 06-21-2008 at 04:31 PM.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-23-2008, 05:45 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,609
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
The reason here is that same log files are directed on different instance of your application. Try to make new log file structure for each instance.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 06-24-2008, 08:59 AM
Member
 
Join Date: Jun 2008
Posts: 6
ajaykumar_mohini is on a distinguished road
log4j logfiles are not getting rolled over
Hi Eranga can u please explain a bit more on this i couldn't get it.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 06-24-2008, 09:41 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,609
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Say you run the application. Logs start to writes on. Then you start the same application again, but it use the same log files too. What I try to say is, use different files for this.

In such cases what I have done is change the file name with application start time or such similar detail which is specific to that time only.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 06-24-2008, 09:54 AM
rjuyal's Avatar
Senior Member
 
Join Date: Mar 2008
Location: Delhi, India
Posts: 187
rjuyal is on a distinguished road
Ajay, have you used appenders correctly?
please post your log4j.properties !!
__________________
i am the future
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 06-24-2008, 03:03 PM
Member
 
Join Date: Jun 2008
Posts: 6
ajaykumar_mohini is on a distinguished road
log4j logfiles are not getting rolled over
These are my log4j properties



log4j.appender.RF.MaxBackupIndex=5
log4j.appender.RF.layout.ConversionPattern=%p %c %d{dd-MMM-yyyy HH\:mm\:ss}- %m%n
log4j.appender.RF.layout=org.apache.log4j.PatternL ayout
log4j.appender.RF.MaxFileSize=1MB
log4j.appender.RF=org.apache.log4j.RollingFileAppe nder
log4j.appender.RF.File=logs/mqadapter.log

log4j.logger.com.boeing.dd2cai.common=INFO, RF
log4j.additivity.com.boeing.dd2cai.common=false
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 06-26-2008, 11:50 AM
Member
 
Join Date: Jun 2008
Posts: 6
ajaykumar_mohini is on a distinguished road
log4j logfiles are not getting rolled over
Hi Eranga,
Thanks for the suggestion i am now creating different log files for different instances(there would be only one instance per jvm as it the class is singleton) and its rolling over fine.But the catch here is that every time i stop my jvm and start again then a new set of log files are created thiss may turnaround to be nightmare in the long run can u please suggest a workaround for this.

With Kind Regards
Ajay
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 06-26-2008, 12:18 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,609
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
In that way you have it. Is it really trouble for you? Actually all depends on your implementation. Say the log file size you defined 10MB, depends on the time take to reach that level you have a mess. That mean you have to formated your log records in shorter with most important data.

Even for separate instance try to use the same log file for a day. For a day you can handle the file size. If the file size is exceeded make the second file of the first.

I hope it's clear to you.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding Log4j sidiq New To Java 0 04-07-2008 09:35 PM
log4j with Applet sunjavaboy Java Applets 0 03-25-2008 02:13 AM
Log4j chakri New To Java 1 02-09-2008 12:15 AM
log4j swapna_d New To Java 5 01-21-2008 10:49 AM
Problems using log4j fred Advanced Java 1 08-06-2007 05:30 AM


All times are GMT +3. The time now is 02:31 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org