Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- java -Dlogback.configurationFile=/path/to/config.xml chapters.configuration.MyApp1
- System.setProperty("logback.configurationFile", "/path/to/config.xml");
- class Main {
- static { System.setProperty("logback.configurationFile", "/path/to/config.xml");}
- private final Logger LOG = LoggerFactory.getLogger(Main.class);
- public void main (String[] args) { ... }
- }
- LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator configurator = new JoranConfigurator();
- InputStream configStream = FileUtils.openInputStream(logbackPropertiesUserFile);
- configurator.setContext(loggerContext);
- configurator.doConfigure(configStream); // loads logback file
- configStream.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement