I m using embedded tomcat in my java application. below is my source code. however tomcat is not generating any log.
embedded = new Embedded();
e
You need to include the tomcat-embed-logging-juli-8.0.15.jar in your classpath.
I used this code to load the logging.properties file and configure the logging externally using the normal java logging approach:
//Loads custom logging configuration located in a properties file named logging.properties
try (InputStream inputStream = new FileInputStream("logging.properties")) {
LogManager.getLogManager().readConfiguration(inputStream);
System.out.println("Custom logging configuraton loaded successfully");
} catch (Exception exception) {
System.err.println ("Custom logging configuration don't found using default system logging configuration.");
}
For more details about configure the logging.properties use this pages: Tomcat logging, org.apache.juli.FileHandler
Also you can use the java.util.logging.FileHandler that is also compatible with the juli aproach an has another advanced configuration options: java.util.logging.FileHandler
There is another jar for use log4j but for me this works fine. Note: I used the tomcat embedded 8.0.15 but there are new versions now.