sgargel
sgargel

Reputation: 1046

Wildfly 10 not writing logs to periodic handler

My war myApp is deployed into wildfly 10.

myApp has its own log4j.properties:

log4j.rootLogger=DEBUG, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d - myApp: %m %n

Wildfly has default standalone configuration

Root Logger

Handler CONSOLE

Handler FILE (Periodic)

In Wildfly console i can see logs generated from myApp:

12:58:43,480 INFO  [io.undertow.servlet] (ServerService Thread Pool -- 65) 2 Spring WebApplicationInitializers detected on classpath
12:58:43,521 INFO  [io.undertow.servlet] (ServerService Thread Pool -- 63) 2 Spring WebApplicationInitializers detected on classpath
2017-05-08 12:58:44,337 - myApp:  
2017-05-08 12:58:44,353 - myApp:   .   ____          _            __ _ _ 
2017-05-08 12:58:44,353 - myApp:  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \ 
2017-05-08 12:58:44,353 - myApp: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
2017-05-08 12:58:44,354 - myApp:  \\/  ___)| |_)| | | | | || (_| |  ) ) ) ) 
2017-05-08 12:58:44,354 - myApp:   '  |____| .__|_| |_|_| |_\__, | / / / / 
2017-05-08 12:58:44,354 - myApp:  =========|_|==============|___/=/_/_/_/ 
2017-05-08 12:58:44,360 - myApp:  :: Spring Boot ::        (v1.4.1.RELEASE) 
2017-05-08 12:58:44,361 - myApp:  
12:58:44,366 INFO  [stdout] (ServerService Thread Pool -- 65) 
12:58:44,366 INFO  [stdout] (ServerService Thread Pool -- 65)   .   ____          _            __ _ _
12:58:44,366 INFO  [stdout] (ServerService Thread Pool -- 65)  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
12:58:44,366 INFO  [stdout] (ServerService Thread Pool -- 65) ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
12:58:44,367 INFO  [stdout] (ServerService Thread Pool -- 65)  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
12:58:44,367 INFO  [stdout] (ServerService Thread Pool -- 65)   '  |____| .__|_| |_|_| |_\__, | / / / /
12:58:44,367 INFO  [stdout] (ServerService Thread Pool -- 65)  =========|_|==============|___/=/_/_/_/
12:58:44,375 INFO  [stdout] (ServerService Thread Pool -- 65)  :: Spring Boot ::        (v1.4.3.RELEASE)
12:58:44,375 INFO  [stdout] (ServerService Thread Pool -- 65) 

But i cant find them in server.log:

12:58:43,480 INFO  [io.undertow.servlet] (ServerService Thread Pool -- 65) 2 Spring WebApplicationInitializers detected on classpath
12:58:43,521 INFO  [io.undertow.servlet] (ServerService Thread Pool -- 63) 2 Spring WebApplicationInitializers detected on classpath
12:58:44,366 INFO  [stdout] (ServerService Thread Pool -- 65) 
12:58:44,366 INFO  [stdout] (ServerService Thread Pool -- 65)   .   ____          _            __ _ _
12:58:44,366 INFO  [stdout] (ServerService Thread Pool -- 65)  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
12:58:44,366 INFO  [stdout] (ServerService Thread Pool -- 65) ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
12:58:44,367 INFO  [stdout] (ServerService Thread Pool -- 65)  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
12:58:44,367 INFO  [stdout] (ServerService Thread Pool -- 65)   '  |____| .__|_| |_|_| |_\__, | / / / /
12:58:44,367 INFO  [stdout] (ServerService Thread Pool -- 65)  =========|_|==============|___/=/_/_/_/
12:58:44,375 INFO  [stdout] (ServerService Thread Pool -- 65)  :: Spring Boot ::        (v1.4.3.RELEASE)
12:58:44,375 INFO  [stdout] (ServerService Thread Pool -- 65) 

Why ?

Upvotes: 0

Views: 899

Answers (2)

JSacks
JSacks

Reputation: 1

Your logging is being handled by the ConsoleAppender configured in your app, not the server log configuration. We had same issue with an application which also had it's own logging configuration. Since it's the only application on the server, we forced the application to use the (extended for our app) server logging configuration. In standalone*.xml file, add at top of xmlns="urn:jboss:domain:logging:3.0" stanza:

<use-deployment-logging-config value="false"/>

Upvotes: 0

Varsha
Varsha

Reputation: 1188

You have used ConsoleAppender. It is used to print logging information to a console. If you need logging in file, use FileAppender.

Upvotes: 3

Related Questions