473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with JDK1.4 logging framework

Hi,
I am using JDK1.4 logging framework and below are the properties that I have in my logging.properties file to configure logging..

handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
.level= INFO
java.util.logging.ConsoleHandler.level=SEVERE
java.util.logging.ConsoleHandler.formatter=java.ut il.logging.SimpleFormatter
java.util.logging.FileHandler.level=INFO
java.util.logging.FileHandler.pattern=%h/java%u.log
java.util.logging.FileHandler.append=true
java.util.logging.FileHandler.limit= 50000
java.util.logging.FileHandler.count= 1
java.util.logging.FileHandler.formatter=java.util. logging.SimpleFormatter

Using this every time I run my application the desired log file is getting genrated and apart from that additional files are being created like:

if my log file name is logger.log

logger.log.1
logger.log.2
logger.log.3
logger.log.4
logger.log.5
logger.log.6
logger.log.7
logger.log.1.lck
logger.log.2.lck
logger.log.3.lck
logger.log.4.lck
logger.log.5.lck
logger.log.6.lck
logger.log.7 .lck

Can anybody suggest how to avoid these files?
Aug 18 '07 #1
3 7168
JosAH
11,448 Expert 8TB
Can anybody suggest how to avoid these files?
These lock files (.lck) indicate that you haven't closed your Handlers when your
program terminates. The next time logging starts, it finds these lock files and
creates a new log file.

Try:

Expand|Select|Wrap|Line Numbers
  1. LogManager.getLogManager().reset();
  2.  
... or close all Handlers explitly.

kind regards,

Jos
Aug 18 '07 #2
These lock files (.lck) indicate that you haven't closed your Handlers when your
program terminates. The next time logging starts, it finds these lock files and
creates a new log file.

Try:

Expand|Select|Wrap|Line Numbers
  1. LogManager.getLogManager().reset();
  2.  
... or close all Handlers explitly.

kind regards,

Jos
Hi,
I tried closing my logger handlers with the following method:
public void closeLogger(){
Handler[] handlers = logger.getHandlers();
for(int i=0; i<handlers.length; i++){
handlers[i].close();
}
}

But still the problem persists.
I tried LogManager.getLogManager().reset(); as well and it only reduces the number of .lck files that are getting generated.
Any suggestions?

Regards,
Pundarikakshaiah
Aug 20 '07 #3
Hi,
One way I could resolve this issue is by making my logger class as singleton and all the other classes in my application use this single instance to log the information. I have noticed that each time I invoke the Logger.getLogger() method to get a logger for a class, a corresponding numbered log and .lck file is getting generated.

But still when we make it a singleton class it generates one .lck file for my log file. For ex: if my log file name is a.log, it generates a.log.lck as well.

While dicussing with one of my friend I came to know that this issue has been resolved in JDK1.5 Loging framework.

Regards,
Pundarikakshaiah
Aug 21 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Roy Benjamin | last post by:
I'm developing a WEB service for Sun ONE deployment (AppServer7). I'm developing on Windows XP Pro though will deploy on Solaris, Sun AppServer7 includes a XercesImpl.jar in share/lib. 2 kb...
0
by: Nermin Brgulja | last post by:
Hi, I am using jdk1.4 Logger with a FileHandler for logging in a web application, and have two questions regarding logging: The first question is: I've created an Logger and mapped it to an...
0
by: s | last post by:
Hi, I am a new user to j2sdkee1.2.1 After installing this I couldn't run this command "j2ee -verbose" it shows following error: C:\>j2ee -verbose Fatal Error: This J2EE SDK release runs only...
0
by: robert | last post by:
As more and more python packages are starting to use the bloomy (Java-ish) 'logging' module in a mood of responsibility and as I am not overly happy with the current "thickener" style of usage, I...
2
by: Tod Olson | last post by:
Anyone have advice for importing the logging module using MacPython 2.4.3? MacPython installs the logging module in: /Library/Frameworks/Python.framework/Versions/2.4/lib/logging/ There's an...
1
by: rameshkumarc | last post by:
can anyone plz tell abt the difference between jdk1.5 and jdk1.6..what are all improvement made in jdk1.6
5
by: Ananthu | last post by:
Hi I have done all the codings part for connecting mysql server with java application but when i try to compile,the compilation is successful and during execution i get the following message, ...
4
by: Alexandru Mosoi | last post by:
why doesn't logging throw any exception when it should? how do I configure logging to throw exceptions? .... logging.fatal('asdf %d', '123') .... except: .... print 'this line is never...
2
myusernotyours
by: myusernotyours | last post by:
Hi All, Am working on a Java application in which I have to use the JNI to Interface with some native code for both windows and unix. Am using netbeans IDE with the C/C++ pack installed. Am also...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.