0
votes

Code:

public class TestLog{

    private static final Logger logger = LoggerFactory.getLogger(TestLog.class);
    public static void main(String[] args) {
        logger.info("test log");
    }
}

Console output:

G:\work\Workspaces\eclipse20151214\Pack\target>java -cp Pack-0.0.1-SNAPSHOT.jar com.zzy.pack.TestLog

log4j:WARN No appenders could be found for logger (com.zzy.pack.TestLog).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

1
Just make it available to classpath, is the properties packed in .jar file ?jmj

1 Answers

0
votes

This has nothing to do with maven. Maven is mainly is a build tool. So, Maven has built a jar for you (I assume you've run something like mvn install beforehands and got Pack-0.0.1-SNAPSHOT.jar )

Now The running itself is from command line and this means that you will construct the classpath by yourself. In this case just ensure that log4j.jar is in the classpath and add it to the java process script.

Hope this helps