import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
...
...
...
if (env.equals("DEV")) {
setLog4j2ConfigFile("log4j2-dev.xml");
}
private void setLog4j2ConfigFile(String log4j2ConfigFile) throws URISyntaxException {
LoggerContext context = (LoggerContext) LogManager.getContext(false);
context.setConfigLocation(getClass().getResource(log4j2ConfigFile).toURI());
}
More than 1 year has passed since last update.
Java - How to Set Difference Configuration Files for Log4j2
Last updated at Posted at 2021-10-15
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00