[Opensrf-commits] r1176 - trunk/src/java/org/opensrf
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Dec 16 15:21:41 EST 2007
Author: erickson
Date: 2007-12-16 15:00:28 -0500 (Sun, 16 Dec 2007)
New Revision: 1176
Modified:
trunk/src/java/org/opensrf/Sys.java
Log:
parsing logfile settings and initing logger
Modified: trunk/src/java/org/opensrf/Sys.java
===================================================================
--- trunk/src/java/org/opensrf/Sys.java 2007-12-16 19:58:38 UTC (rev 1175)
+++ trunk/src/java/org/opensrf/Sys.java 2007-12-16 20:00:28 UTC (rev 1176)
@@ -9,6 +9,20 @@
public class Sys {
+ private static void initLogger(Config config) {
+ if(Logger.instance() == null) {
+ try {
+ String logFile = config.getString("/logfile");
+ int logLevel = config.getInt("/loglevel");
+ Logger.init( (short) config.getInt("/loglevel"), new FileLogger(logFile));
+ /** add syslog support... */
+ } catch(Exception e) {
+ /* by default, log to stderr at WARN level */
+ Logger.init(Logger.WARN, new Logger());
+ }
+ }
+ }
+
/**
* Connects to the OpenSRF network so that client sessions may communicate.
* @param configFile The OpenSRF config file
@@ -19,8 +33,6 @@
public static void bootstrapClient(String configFile, String configContext)
throws ConfigException, SessionException {
- if(Logger.instance() == null) /* provide a sane default logger */
- Logger.init(Logger.WARN, new Logger());
/** see if the current thread already has a connection */
XMPPSession existing = XMPPSession.getThreadSession();
@@ -32,6 +44,8 @@
config.parse(configFile);
Config.setConfig(config); /* set this as the global config */
+ initLogger(config);
+
/** Collect the network connection info from the config */
String username = config.getString("/username");
String passwd = config.getString("/passwd");
@@ -48,6 +62,7 @@
+ "_t"+ Thread.currentThread().getId();
+
try {
/** Connect to the Jabber network */
More information about the opensrf-commits
mailing list