Bookmark Topic Watch Topic
  • New Topic

Logging problem .Too many .lck files created.

 
madhup narain
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I have been trying my hand with the logging API of java and want to implement it.Have had some success with it.

I have noticed while using Files for logging .lck files (which are LOCK files ) are created and the .lck files may become too large. What i dont understand is why are many .lck files created and why dosent the system remove them once the process is through with writing.

My second problem is that every time an information is entered in the Log file there is a 'Particular' data time format that is appended with the information. I would not tike the data-time combination being printed every time as it makes information quite hard to decipher.

Below is the code i used..
.
.
.
Logger oLogger = Logger.getLogger("LOGGER");
FileHandler oFileHandler = new FileHandler("my.txt", true);
oFileHandler .setFormatter(new SimpleFormatter());
oLogger.addHandler(oFileHandler);
.
.
.
oLogger.logp(Level.WARNING,"Array","main","This is a warning");
oLogger.logp(Level.WARNING,"Array","main","This is a warning");
oLogger.logp(Level.WARNING,"Array","main","This is a warning");
.
.

The output i get is..
9/05/2005 10:44:40 Array main
WARNING: This is a warning
9/05/2005 10:44:40 Array main
WARNING: This is a warning
9/05/2005 10:44:40 Array main
WARNING: This is a warning

what i would like...is date and Time to be formatted..Perhaps not be there
and how do i get rid of .lck files.

in my case .lck files ranged from
my.txt.1
my.txt.1.lck

to
my.txt.15
my.txt.1.lck

those are 30 files and i am wasting space....as well as complicating things

Regards
Madhup
 
madhup narain
Ranch Hand
Posts: 148
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Ok guys,

was able to figure out why so many lock files were created, but i need a way to format the data and the time thats being appended to the LOG messages.

regards
 
sweety kamal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Report post to moderator
please post the solution I am stuck with .lck
 
fred rosenberger
lowercase baba
Bartender
Posts: 12196
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
sweety kamal wrote:please post the solution I am stuck with .lck

you realize this thread is over six years old?

If you have a problem, i would suggest you create your own thread, post all the relevant information, and go from there.
 
    Bookmark Topic Watch Topic
  • New Topic