Skip to content

Commit

Permalink
Merge pull request #18 from Nosto/feature/add-log4j2-support
Browse files Browse the repository at this point in the history
Add support for Log4j2
  • Loading branch information
mridang committed May 3, 2016
2 parents bfc2f86 + bfb4693 commit 63594d7
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 153 deletions.
Binary file removed framework/lib/log4j-1.2.17.jar
Binary file not shown.
Binary file added framework/lib/log4j-api-2.5.jar
Binary file not shown.
Binary file added framework/lib/log4j-core-2.5.jar
Binary file not shown.
Binary file added framework/lib/log4j-slf4j-impl-2.5.jar
Binary file not shown.
Binary file removed framework/lib/slf4j-api-1.7.16.jar
Binary file not shown.
Binary file added framework/lib/slf4j-api-1.7.21.jar
Binary file not shown.
Binary file added framework/lib/slf4j-ext-1.7.21.jar
Binary file not shown.
Binary file removed framework/lib/slf4j-log4j12-1.7.16.jar
Binary file not shown.
177 changes: 95 additions & 82 deletions framework/src/play/Logger.java

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion framework/src/play/db/DBPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.commons.lang.StringUtils;

import jregex.Matcher;
import org.apache.log4j.Level;
import play.Logger;
import play.Play;
import play.PlayPlugin;
Expand Down
15 changes: 12 additions & 3 deletions framework/src/play/db/jpa/JPAPlugin.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package play.db.jpa;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.log4j.Level;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.hibernate.ejb.Ejb3Configuration;

import play.Logger;
Expand Down Expand Up @@ -117,7 +120,10 @@ public EntityManager em(String key) {
@Override
public void onApplicationStart() {
org.hibernate.ejb.HibernatePersistence persistence = new org.hibernate.ejb.HibernatePersistence();
org.apache.log4j.Logger.getLogger("org.hibernate.SQL").setLevel(Level.OFF);
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggerConfig("org.hibernate.SQL");
loggerConfig.setLevel(Level.OFF);
ctx.updateLoggers();

Set<String> dBNames = Configuration.getDbNames();
for (String dbName : dBNames) {
Expand Down Expand Up @@ -185,7 +191,10 @@ public void onApplicationStart() {
properties.put("hibernate.dialect", getDefaultDialect(dbConfig, dbConfig.getProperty("db.driver")));

if (dbConfig.getProperty("jpa.debugSQL", "false").equals("true")) {
org.apache.log4j.Logger.getLogger("org.hibernate.SQL").setLevel(Level.ALL);
ctx = (LoggerContext) LogManager.getContext(false);
loggerConfig = ctx.getConfiguration().getLoggerConfig("org.hibernate.SQL");
loggerConfig.setLevel(Level.ALL);
ctx.updateLoggers();
}

Thread thread = Thread.currentThread();
Expand Down
67 changes: 0 additions & 67 deletions framework/src/play/utils/ANSIConsoleAppender.java

This file was deleted.

0 comments on commit 63594d7

Please sign in to comment.