commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Bessmertnyj" <d...@isd.dp.ua>
Subject Re: Commons Logging settings
Date Wed, 03 Jan 2007 07:49:13 GMT
Hi Dennis,

Thank you for answer.
I'm using 1.1 version.
And I'm using Jdk14Logger implementation.
I just made littel experement and as I see
when I try to launch through JNLP without Commons Logging, problem the same.
I have looked into java.util.logging.LogManager class inside (method 
readConfiguration() ) and here is code
which reads configuration:
String fname = System.getProperty("java.util.logging.config.file");
 if (fname == null) {
   fname = System.getProperty("java.home");
   if (fname == null) {
     throw new Error("Can't find java.home ??");
   }
  File f = new File(fname, "lib");
  f = new File(f, "logging.properties");
  fname = f.getCanonicalPath();
}
InputStream in = new FileInputStream(fname);
BufferedInputStream bin = new BufferedInputStream(in);
try {
    readConfiguration(bin);
} finally {
if (in != null) {
    in.close();
}

As you see, they using File object here, but I have
URL link 
jar:http://localhost:8080/newframework/lib/framework.jar!/resources/logger.cfg

This small test
File file = new File(new 
URL("jar:http://localhost:8080/newframework/lib/framework.jar!/resources/logger.cfg").toString());
FileInputStream fs = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(fs));
String result;
while((result = reader.readLine()) != null) {
   System.out.println(result);
}

Throws an exception
Exception in thread "main" java.io.FileNotFoundException: 
jar:http:\localhost:8080\newframework\lib\framework.jar!\resources\logger.cfg 
(The filename, directory name, or volume label syntax is incorrect)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at test.Test.main(Test.java:15)


So, how I can use logging with Java Web Start or Applets I can't understand. 
:-(

--
Denis Bessmertnyj



----- Original Message ----- 
From: "Dennis Lundberg" <dennisl@apache.org>
To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
Sent: Tuesday, January 02, 2007 11:38 PM
Subject: Re: Commons Logging settings


> Hi Denis
>
> Are you using commons-logging 1.1? There is a bug in that version which 
> only presents itself when you run under a security manager. We stumbled 
> upon this for our applets, that are also delivered as signed jars in much 
> the same way as you do. Perhaps this problem occurs for java web start as 
> well?
>
> We reverted back to 1.0.4 as a workaround. There is a 1.1.1 release coming 
> up soon, that has a fix for this bug. You might want to try a nightly 
> build to see if it solves your problem:
>   http://people.apache.org/builds/jakarta-commons/nightly/commons-logging/
>
>
> -- 
> Dennis Lundberg
>
> Denis Bessmertnyj wrote:
>> I have software which I deliver to client through Java Web Start.
>> I use Apache Commons Logging, but it doesn't work when I use it through 
>> Web Start,
>> because it can't find config file for logger.
>> I deliver my application with certificate and all permissions.
>> I store config file in jar file which I also deliver to client through 
>> JWS.
>> Here is my code of getting config file on client:
>>
>> ClassLoader classLoader = this.getClass().getClassLoader();
>> URL loggerConfigFileURL = 
>> classLoader.getResource("resources/logger.cfg");
>> System.setProperty("java.util.logging.config.file", 
>> loggerConfigFileURL.toString());
>>
>>
>> By the way, ClassLoader finds config file in jar, and
>> loggerConfigFileURL var has value: 
>> jar:http://localhost:8080/newframework/lib/framework.jar!/resources/logger.cfg 
>> But logger doesn't want to work!!! It's working only if I start locally 
>> (not through JWS) my application and
>> map "java.util.logging.config.file" to absoulute local path to logger.cfg 
>> file (not using URL notation).
>>
>> How I realize it and what I do wrong?
>>
>> thnx!
>>
>> ---
>> Denis Bessmertnyj,
>> GUI SoftWeb
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message