Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. java -Dlogback.configurationFile=/path/to/config.xml chapters.configuration.MyApp1
  2.  
  3. System.setProperty("logback.configurationFile", "/path/to/config.xml");
  4.  
  5. class Main {
  6. static { System.setProperty("logback.configurationFile", "/path/to/config.xml");}
  7. private final Logger LOG = LoggerFactory.getLogger(Main.class);
  8.  
  9. public void main (String[] args) { ... }
  10. }
  11.  
  12. LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
  13. JoranConfigurator configurator = new JoranConfigurator();
  14. InputStream configStream = FileUtils.openInputStream(logbackPropertiesUserFile);
  15. configurator.setContext(loggerContext);
  16. configurator.doConfigure(configStream); // loads logback file
  17. configStream.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement