I am trying to get Weblogic 12c to do logging separately for application instead of writing everything to server logs.
I am using java.util.logging as follows:
private static final Logger log = Logger.getLogger(ReceiveController.class.getName());
...
log.info("Initializing...");
This is my weblogic.xml:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<context-root>mywebapp</context-root>
<logging>
<log-filename>mywebapp.log</log-filename>
<logging-enabled>true</logging-enabled> <!--true/false - no difference-->
</logging>
</weblogic-web-app>
Log file mywebapp.log gets created, but logs still goes to AdminServer.log.
What I expect: Logs of mywebapp to go to mywebapp.log, and not to AdminServer.log.
Also, at https://docs.oracle.com/cd/E24329_01/web.1211/e21049/weblogic_xml.htm#i1063198 it says "The full address of the filename is required.", but file gets created even if only filename is specified. mywebapp.log is empty even if I provide full path.
UPDATE. The question is not about separating of log messages by the logger name. For example we have two applications based on Spring Framework. In both cases the logger name starts with something like "org.springframework". The question is how to separate messages even if the logger name is the same.
For example Tomcat uses customised LogManager:
Apache Tomcat has its own implementation of several key elements of java.util.logging API. This implementation is called JULI. The key component there is a custom LogManager implementation, that is aware of different web applications running on Tomcat (and their different class loaders). It supports private per-application logging configurations. It is also notified by Tomcat when a web application is unloaded from memory, so that the references to its classes can be cleared, preventing memory leaks.