I'm trying to use Logback with Wildfire 9. For that, I added a jboss-deployment-structure.xml file in my WEB-INF folder with this content (I excluded also Hibernate to be sure to not pull jboss-logging):
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="logging" />
</exclude-subsystems>
<exclusions>
<module name="org.hibernate" />
</exclusions>
</deployment>
</jboss-deployment-structure>
It's working fine except I have blank lines between each log:
14:25:25,249 INFO [org.jboss.as.jpa] (MSC service thread 1-8) WFLYJPA0002: Read persistence.xml for portalPU
14:25:25,253 INFO [org.jboss.as.jpa] (MSC service thread 1-8) WFLYJPA0002: Read persistence.xml for emptyPU
14:25:25,631 INFO [stdout] (MSC service thread 1-1) 14:25:25,556 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
14:25:25,631 INFO [stdout] (MSC service thread 1-1) 14:25:25,557 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
and:
14:26:49,827 INFO [stdout] (default task-2) 2016-05-03 14:26:49 [default task-2] DEBUG f.s.q.p.web.filters.InstallFilter -Users found: 1
14:26:50,676 INFO [stdout] (default task-3) 2016-05-03 14:26:50 [default task-3] DEBUG f.s.q.p.web.filters.InstallFilter -Users found: 1
14:26:50,716 INFO [stdout] (default task-4) 2016-05-03 14:26:50 [default task-4] DEBUG f.s.q.p.web.filters.InstallFilter -Users found: 1
14:26:50,760 INFO [stdout] (default task-5) 2016-05-03 14:26:50 [default task-5] DEBUG f.s.q.p.web.filters.InstallFilter -Users found: 1
14:26:50,779 INFO [stdout] (default task-6) 2016-05-03 14:26:50 [default task-6] DEBUG f.s.q.p.web.filters.InstallFilter -Users found: 1
14:26:51,162 INFO [stdout] (default task-8) 2016-05-03 14:26:51 [default task-8] DEBUG f.s.q.p.web.filters.InstallFilter -Users found: 1
14:26:51,180 INFO [stdout] (default task-7) 2016-05-03 14:26:51 [default task-7] DEBUG f.s.q.p.web.filters.InstallFilter -Users found: 1
In my logback.xml, I'm using this pattern for the console:
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern><![CDATA[%d{yyyy-MM-dd HH:mm:ss} [%t] %-5level %logger{36} -%msg%n]]></Pattern>
</layout>
</appender>
And in the logging.properties file of Wildfly, I have this:
formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.COLOR-PATTERN.properties=pattern
formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n
I think the problem is comming from the %n for the ConsoleAppender and the PatternFormatter. If I'm trying to remove the %n for ConsoleAppender, it's like if I don't have flushes anymore: I can't see the logs. If I remove the %n for PatternFormatter, I don't have the blank lines but Wildfly's logs don't have linefeed anymore.
How to have something clean without blank lines ?
I have removed %n in standalone.xml and now the log in Eclipse console is fine
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e"/>
</formatter>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With