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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Logging problem .Too many .lck files created.

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
please post the solution I am stuck with .lck
 
lowercase baba
Posts: 13003
66
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic