Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Log4j memory leak ?

Posted on 2004-04-26
6
Medium Priority
?
1,630 Views
Last Modified: 2007-12-19
Hi all
We are using log4j version 1.2.8.
Our configuration is 10 rolling log files for each of the following debug,error and trace, each file size is 20M.
The problem is that the memory consumption grows directly with the logs grows.
I have system with 1G memory, starting the application the memory consumption is 100M and when
all 30 files (debug,error and trace) were full I checked the memory and it was ~700M used.
I delete 27 files (debg.log.x , error.log.x and trace.log.x) and the memory decreased back to 100M.
How come ? any idea ? we wrap the log4j in our project , anything we should take of when wraping it ?
0
Comment
Question by:dannysh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 10917121
That seems all quite natural...
0
 
LVL 9

Accepted Solution

by:
mmuruganandam earned 200 total points
ID: 10917149
You have something called FileAppender.  Write your own FileAppender by extending the FileAppender class.

There you have few controls on closing the files and few..
0
 

Author Comment

by:dannysh
ID: 10917166
>> That seems all quite natural
What do u mean ? should it be like that ?

>>You have something called FileAppender.  Write your own FileAppender by extending the FileAppender

How they implemnt it ? do they keep all lojs in memory also ? any idea where can I find implemenmation for it ?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:CEHJ
ID: 10917168
If you want to limit the size to which your files grow (and it sounds like you might do) you don't need to subclass a FileAppender to do this - the max file size is a configurable property that you can change in your config file, e.g.:

log4j.appender.A1.MaxFileSize=300KB
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10917186
What kind of rolling log is yours....

Is it time roll over or size roll over..
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10917202
>>What do u mean ? should it be like that ?

What i mean is that it doesn't surprise me. I'd take a guess that to avoid a bad performance hit due to continually opening and closing files, they've avoided a simple append to the log file by normal io means of appending, by buffering. As the files grow in size, the buffer may well do too. (Just a guess ;-))
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question