public class DatastoreRegistry implements AutoCloseable
{
protected static JLoggerLog4j log = JLoggerLog4j
- .getLogger(DatastoreRegistry.class.getCanonicalName());
+ .getLogger(DatastoreRegistry.class);
/**
* map between Datastore objects and the objects they are handling- used to
}
}
+ public static JLogger getLogger(Class c)
+ {
+ return getLogger(c);
+ }
+
+ public static JLogger getLogger(Class c, LogLevel loglevel)
+ {
+ return getLogger(c.getCanonicalName(), loglevel);
+ }
+
public static JLogger getLogger(String name)
{
return getLogger(name, LogLevel.INFO);
loggerSetLevel(level);
}
- private boolean println(LogLevel level, String message, Throwable t)
+ private boolean println(LogLevel loglevel, String message, Throwable t)
{
+ if (loglevel.compareTo(this.level) < 0)
+ {
+ return false;
+ }
if (!loggerExists() || Platform.isJS())
{
- String logLine = String.format("%s: %s", level.toString(), message);
+ String logLine = String.format("%s: %s", loglevel.toString(),
+ message);
System.out.println(logLine);
if (t != null)
{
- if (level.compareTo(LogLevel.DEBUG) <= 0)
+ if (loglevel.compareTo(LogLevel.DEBUG) <= 0)
t.printStackTrace(System.err);
else
System.err.println(t.getMessage());
}
else
{
- loggerLogMessage(level, message, t);
+ loggerLogMessage(loglevel, message, t);
return true;
}
}
{
private Logger logger = null;
+ public static JLoggerLog4j getLogger(Class c)
+ {
+ return getLogger(c);
+ }
+
+ public static JLoggerLog4j getLogger(Class c, LogLevel loglevel)
+ {
+ return getLogger(c.getCanonicalName(), loglevel);
+ }
+
public static JLoggerLog4j getLogger(String name)
{
return getLogger(name, LogLevel.INFO);
private JLoggerLog4j(String name, LogLevel level)
{
- // super(name, level);
this.name = name;
this.level = level;
this.loggerSetup();
return this.logger;
}
- public synchronized static void addAppender(JLoggerLog4j l1,
+ public synchronized static void addAppender(JLoggerLog4j level,
Appender appender)
{
if (!Platform.isJS())
- Log4j.addAppender(l1.getLoggerObject(), appender);
+ Log4j.addAppender(level.getLoggerObject(), appender);
}
public synchronized static void addAppender(JLoggerLog4j l1,