I am trying to run a java program as a Java Application (with main() method) in WSAD. But it is unable to get the environmental variables like Log4j and other property files. And I am getting this error:
log4j:WARN No appenders could be found for logger (log4j:WARN Please initialize the log4j system properly.
Waiting for your replies!
Thank You!
-
Help! (6 messages)
- Posted by: rajanikumar raju babulingam
- Posted on: January 06 2005 10:10 EST
Threaded Messages (6)
- Help! by Edson Alves Pereira on January 06 2005 14:18 EST
- Help! by rajanikumar raju babulingam on January 06 2005 15:46 EST
-
Add it to your classpath by Pat Maddox on January 07 2005 07:08 EST
-
Add it to your classpath by rajanikumar raju babulingam on January 07 2005 10:47 EST
- Standard classpath by Pat Maddox on January 10 2005 10:55 EST
-
Add it to your classpath by rajanikumar raju babulingam on January 07 2005 10:47 EST
-
Add it to your classpath by Pat Maddox on January 07 2005 07:08 EST
- Help! by rajanikumar raju babulingam on January 06 2005 15:46 EST
- Problem with log4j by Stephane Vaucher on January 07 2005 02:32 EST
-
Help![ Go to top ]
- Posted by: Edson Alves Pereira
- Posted on: January 06 2005 14:18 EST
- in response to rajanikumar raju babulingam
What kind of variables are you looking for? Are then system variables like user.home? -
Help![ Go to top ]
- Posted by: rajanikumar raju babulingam
- Posted on: January 06 2005 15:46 EST
- in response to Edson Alves Pereira
Yes you are right!
I am trying to access the property files (to access DB2,LOG4J etc). when I run the application within the websphere server environment, i am able to access the property files, but when i try to run as a Java Application, I am unable to access the property files.
Waiting for your reply.
Thanks! -
Add it to your classpath[ Go to top ]
- Posted by: Pat Maddox
- Posted on: January 07 2005 07:08 EST
- in response to rajanikumar raju babulingam
Just make sure the log4j.properties file is on your classpath. When it's in Websphere, it's most likely in a location already loaded into your cp. When you're running the standalone app, you need to specify it. -
Add it to your classpath[ Go to top ]
- Posted by: rajanikumar raju babulingam
- Posted on: January 07 2005 10:47 EST
- in response to Pat Maddox
Just make sure the log4j.properties file is on your classpath. When it's in Websphere, it's most likely in a location already loaded into your cp. When you're running the standalone app, you need to specify it.
Pat,
Can you please tell me how to do that?
Thanks
Raj -
Standard classpath[ Go to top ]
- Posted by: Pat Maddox
- Posted on: January 10 2005 10:55 EST
- in response to rajanikumar raju babulingam
Just use the -cp or -classpath switch with the Java command. Or include the log4j.properties file in the compiled classes dir or jar file.
java -classpath path/to/dir net.javaspot.MyApp
path/to/dir is the dir containing the log4j.properties file. -
Problem with log4j[ Go to top ]
- Posted by: Stephane Vaucher
- Posted on: January 07 2005 02:32 EST
- in response to rajanikumar raju babulingam
First of all, use a real subject. A message like "Help!" doesn't help me as i only see titles. It makes me and most other readers want to skip it.
Secondly, you are not trying to access env variables. Read the log, it does not say: "log4j system property", it says: "log4j system properly" as in proper or correct. You simply need to configure log4j. Here is the doc:
http://logging.apache.org/log4j/docs/manual.html#defaultInit
The simplest way is to put a log4j.properties in your classpath (if it's a web app, it's under /WEB-INF/classes). Look at the manual to get a sample log4j.properties file.
HTH,
sv