configuration - How do I get log4J to work - I'm getting "package org.apache.log4j does not exist" -
i know may newbie qestion, i'm having issues setting log4j:
i want run log4j demo, , here's code:
import org.apache.log4j.logger; import org.apache.log4j.basicconfigurator; public class hellolog4j { private static final logger logger = logger.getlogger(hello.class); public static void main(string argv[]) { basicconfigurator.configure(); logger.debug("hello world."); logger.info("what beatiful day."); } }
i set classpath: c:\users\adel\downloads\apache-log4j-1.2.17\log4j-1.2.17.jar in both scheme , user var's
but when run programme still get
errors found: file: c:\users\adel\desktop\various_topics\javaprojects\hellolog4j.java [line: 2] error: bundle org.apache.log4j not exist
i know set classpath right - if run cmd line:
c:\program files\java\jdk1.6.0_20>print %log4j_home% c:\users\adel\downloads\apache-log4j-1.2.17\log4j-1.2.17.jar bein g printed
you neeed add together log4j home classpath jvm needs path log4j classes
if on windows can utilize
set classpath=%classpath%;%log4j_home%
then run app after adding other paths classpath
set classpath=%classpath%;c:\users\adel\....
do not need add together log4jhome 1 time again - %classpath% add together current.
log4j_home not known java used log4j in case of auto config/default config
on side note seek using new log4j2 !
configuration log4j log4
No comments:
Post a Comment