Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java logging problem

Reply
Thread Tools

Java logging problem

 
 
frank
Guest
Posts: n/a
 
      06-23-2005
Just started to look to use the java logging and got this error and
don't know why. Used the example from
http://java.sun.com/j2se/1.4.2/docs/.../overview.html

complaing about this line :
fh = new FileHandler(table.getProperty("dbsLogFile"));

fh is defined as follow in the class:
private static FileHandler fh;


java.io.IOException: Couldn't get lock for "dbslogfile.txt"
java.io.IOException: Couldn't get lock for "dbslogfile.txt"
at java.util.logging.FileHandler.openFiles(FileHandle r.java:361)
at java.util.logging.FileHandler.<init>(FileHandler.j ava:232)
at DBS.DBS.<init>(DBS.java:107)
at DBS.RunDBS.main(RunDBS.java:20)

thanks,

Frank

 
Reply With Quote
 
 
 
 
frank
Guest
Posts: n/a
 
      06-23-2005
oop's put "" around in prop file, sorry

frank wrote:

> Just started to look to use the java logging and got this error and
> don't know why. Used the example from
> http://java.sun.com/j2se/1.4.2/docs/.../overview.html
>
> complaing about this line :
> fh = new FileHandler(table.getProperty("dbsLogFile"));
>
> fh is defined as follow in the class:
> private static FileHandler fh;
>
>
> java.io.IOException: Couldn't get lock for "dbslogfile.txt"
> java.io.IOException: Couldn't get lock for "dbslogfile.txt"
> at java.util.logging.FileHandler.openFiles(FileHandle r.java:361)
> at java.util.logging.FileHandler.<init>(FileHandler.j ava:232)
> at DBS.DBS.<init>(DBS.java:107)
> at DBS.RunDBS.main(RunDBS.java:20)
>
> thanks,
>
> Frank
>


 
Reply With Quote
 
 
 
 
Pete Barrett
Guest
Posts: n/a
 
      06-23-2005
On Thu, 23 Jun 2005 10:05:26 -0400, frank <(E-Mail Removed)> wrote:

>Just started to look to use the java logging and got this error and
>don't know why. Used the example from
>http://java.sun.com/j2se/1.4.2/docs/.../overview.html
>
>complaing about this line :
>fh = new FileHandler(table.getProperty("dbsLogFile"));
>
>fh is defined as follow in the class:
>private static FileHandler fh;
>
>
>java.io.IOException: Couldn't get lock for "dbslogfile.txt"
>java.io.IOException: Couldn't get lock for "dbslogfile.txt"
> at java.util.logging.FileHandler.openFiles(FileHandle r.java:361)
> at java.util.logging.FileHandler.<init>(FileHandler.j ava:232)
> at DBS.DBS.<init>(DBS.java:107)
> at DBS.RunDBS.main(RunDBS.java:20)
>

When the log file is created, a separet lock file called (in your
case) "dbslogfile.txt.lck" is also created. The Logger uses this as a
mutual exclusion mechanism for access to the actual log file. It
doesn't seem to have been able to create it (it would have to create
the lock file before the log file, of course).

A number of reasons spring to mind, notably do you have permission to
write to the directory it will be created in? or the machine it will
be created on? Both at the Java security level and the OS level?


Pete Barrett
 
Reply With Quote
 
jetbrains jetbrains is offline
Junior Member
Join Date: Jun 2006
Posts: 1
 
      06-30-2006
Yes,make sure you have the permission to write the file.
I think below logging tutorial will be useful to you
http://www.developerzone.biz/index.p...3dda27a96827b6
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logging exception with java.util.logging.Logger#log() to file only Royan Java 1 04-01-2008 09:42 PM
Logging to a file and closing it again properly (logging module) Christoph Haas Python 0 06-12-2006 09:58 PM
logging buffered vs. logging history Christian Roos Cisco 4 02-05-2006 10:55 PM
java.util.logging, where to put logging.properties? janne Java 0 09-10-2004 10:18 AM
[java.util.logging] logging only to _one_ file Stefan Siegl Java 0 08-27-2003 12:29 PM



Advertisments