java - JBoss EAP : reload logback config without restarting the server? -


we using jboss enterprise application platform server ie. jboss eap 6.1 our new web applications use logback logging. using jboss eap months , works out cool. also, may know, can deploy , undeploy applications , config files (like e.g. mail-service.xml) during runtime on jboss i.e. without restarting server.

but if change logback.xml config file though on jboss eap deployed in temp directory, jboss eap not recognizing changes , on restarting server jboss eap server deletes changed file , re-deploy complete new package. bit annoying - seems strange logaback config can not 'hot swap' while server running.

setup done auto-reloading :

-- have configured logback setting scan variable true , scanperiod 5 seconds.

are there easy ways work around this, i.e. make possible 'hot swap' logback config file on jboss eap 6.1?

you can put logback.xml in configuration folder , load configuration programmaticaly. in way auto reloading setting should work expected. can load configuation using joran configurator.

here sample code snippet

    loggercontext loggercontext = (loggercontext) loggerfactory.getiloggerfactory();      joranconfigurator configurator = new joranconfigurator();     configurator.setcontext(loggercontext);     loggercontext.reset();     configurator.doconfigure(logback_file_path); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -