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
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();
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");
+ "_t"+ Thread.currentThread().getId();
+
try {
/** Connect to the Jabber network */