I'm working on my java Enterprise application in ejb module with Netbeans.
When I run "MyClass.java" I only view error level.
MyEnterpriseApplication-ejb:Source Packages:
package com.mycompany;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MyClass {
public static final Logger logger = LogManager.getLogger(MyClass.class);
public static void main(String[] arg) {
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:context.xml");
logger.info("level info");
logger.error("level error");
logger.debug("level debug");
logger.warn("level warn");
}
}
When I run this class...
Output:
------------------------------------------------------------------------
Building MyEnterpriseApplication-ejb 1.0-SNAPSHOT
------------------------------------------------------------------------
[dependency:copy]
[resources:resources]
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource
[compiler:compile]
Compiling 1 source file to Z:\NetBeansProjects\MyEnterpriseApplication\MyEnterpriseApplication-ejb\target\classes
[exec:exec]
20:26:23.885 [main] ERROR com.mycompany.MyClass - level error
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 2.328s
Finished at: Mon May 27 20:26:23 CEST 2013
Final Memory: 14M/162M
------------------------------------------------------------------------
How can I add a log4j.xml file and add to spring context file? this is the way?