[jboss-jira] [JBoss JIRA] (WFCORE-1187) Embedded server start / stop / start with new --jboss-home continues to refer to previous server.log

Jean-Francois Denise (JIRA) issues at jboss.org
Tue Apr 26 13:00:00 EDT 2016


    [ https://issues.jboss.org/browse/WFCORE-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13197373#comment-13197373 ] 

Jean-Francois Denise commented on WFCORE-1187:
----------------------------------------------

The EmbeddedServer is setting the right LogContext, the problem is that some of the Server loggers (that are annotated with @MessageLogger, e.g.: ServerLogger) are statics and their implementation is bound to the Logger retrieved at construction time. 
When such static annotated loggers are instantiated, the LogContext is accessed and the "first server" context is retrieved to build a final Logger delegate. The delegate is internally used by the @MessageLogger to delegate actual logging.

So all the static @MessageLogger are bound to a given logging configuration, whatever the changes that can occur in the LogContext.

When the second server is started, the @MessageLogger are not refreshed.

Actually a layer (JBoss module) manages to log in the second file, this is due to the fact that the LoggingManager is re-set each time an embedded server is started.

I don't know this code, but I could suggest a possible fix. 

The DelegatingBasicLogger could define a LoggerProvider interface. @MessageLogger would implement this interface and passes it at construction time. Something like:

public class DelegatingBasicLogger {
 public interface LoggerProvider {
  public Logget getLogger();
 }
DelegatingBasicLogger(LoggerProvider provider) { this.provider = provider; }
....
}

Then for subclass:
class MyLogger extends DelegatingBasicLogger {
MyLogger() {
super(()->LogContext.getLogContext());
}

Would that makes sense?


> Embedded server start / stop / start with new --jboss-home continues to refer to previous server.log
> ----------------------------------------------------------------------------------------------------
>
>                 Key: WFCORE-1187
>                 URL: https://issues.jboss.org/browse/WFCORE-1187
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: CLI
>            Reporter: Ken Wills
>            Assignee: Ken Wills
>
> - start-embedded-server --jboss-home=/foo/bar1
> - stop-embedded-server
> - start-embedded-server --jboss-home=/foo/bar2
> -- server.log in /foo/bar1/standalone/logs/server.log is still written to.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list