Wildfly-Swarm – Logging
Tried this with Wildfly Swarm version 2017.8.1. Seems like in newer versions a new approach is used.
I added the logging artifact in the maven build file:
<dependency> <groupId>org.wildfly.swarm</groupId> <artifactId>logging</artifactId> <version>2017.8.1</version> </dependency>
In /src/main/resources/ a file logging.properties with the following content is setup:
logger.level=INFO logger.handlers=FILE handler.FILE=org.jboss.logmanager.handlers.FileHandler handler.FILE.level=INFO handler.FILE.formatter=PATTERN handler.FILE.properties=append,fileName,autoFlush handler.FILE.append=false handler.FILE.autoFlush=true handler.FILE.fileName=./myapp.log formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter formatter.PATTERN.properties=pattern formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c] %s%E%n
In your code, you setup and use org.jboss.logging.Logger instances like this:
Logger LOG = Logger.getLogger(MyClass.class); LOG.info("Example log message"); LOG.error("Something strange happend", new Exception() );