* root logger name is now retrieve from context instead of always "".

* log file name at server is prefix by the root logger name from context.
* webui will maintain separate log file prefix by "org.adempiere.webui"
This commit is contained in:
Heng Sin Low 2010-07-19 02:47:34 +08:00
parent 970ae6b62a
commit b4cfb20024
10 changed files with 288 additions and 314 deletions

View File

@ -491,9 +491,8 @@ public final class Adempiere
// Set up Log
CLogMgt.setLevel(Ini.getProperty(Ini.P_TRACELEVEL));
if (isClient && Ini.isPropertyBool(Ini.P_TRACEFILE)
&& CLogFile.get(false, null, isClient) == null)
CLogMgt.addHandler(CLogFile.get (true, Ini.findAdempiereHome(), isClient));
if (isClient && Ini.isPropertyBool(Ini.P_TRACEFILE))
CLogMgt.addHandler(new CLogFile(Ini.findAdempiereHome(), true, isClient));
// Set UI
if (isClient)

View File

@ -32,31 +32,11 @@ import java.util.logging.LogRecord;
*/
public class CLogConsole extends Handler
{
/**
* Get Console Handler
* @param create create if not exists
* @return console hander or null
*/
public static CLogConsole get (boolean create)
{
if (s_console == null && create)
s_console = new CLogConsole();
return s_console;
} // get
private static CLogConsole s_console = null;
/**
* Constructor
*/
public CLogConsole ()
{
if (s_console == null)
s_console = this;
else
reportError("Console Handler exists already",
new IllegalStateException("Existing Handler"),
ErrorManager.GENERIC_FAILURE);
initialize();
} // CLogConsole

View File

@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Properties;
import java.util.Vector;
import java.util.logging.ErrorManager;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@ -45,33 +44,11 @@ public class CLogErrorBuffer extends Handler
private static final String LOGS_KEY = "org.compiere.util.CLogErrorBuffer.logs";
/**
* Get Client Log Handler
* @param create create if not exists
* @return handler
*/
public static CLogErrorBuffer get(boolean create)
{
if (s_handler == null && create)
s_handler = new CLogErrorBuffer();
return s_handler;
} // get
/** Appender */
private static CLogErrorBuffer s_handler;
/**************************************************************************
* Constructor
*/
public CLogErrorBuffer ()
{
if (s_handler == null)
s_handler = this;
else
reportError("Error Handler exists already",
new IllegalStateException("Existing Handler"),
ErrorManager.GENERIC_FAILURE);
initialize();
} // CLogErrorBuffer
@ -454,4 +431,21 @@ public class CLogErrorBuffer extends Handler
return sb.toString ();
} // toString
public static CLogErrorBuffer get(boolean create) {
Handler[] handlers = CLogMgt.getHandlers();
for (Handler handler : handlers)
{
if (handler instanceof CLogErrorBuffer)
return (CLogErrorBuffer) handler;
}
if (create)
{
CLogErrorBuffer handler = new CLogErrorBuffer();
CLogMgt.addHandler(handler);
return handler;
}
return null;
}
} // CLogErrorBuffer

View File

@ -33,22 +33,6 @@ import java.util.logging.LogRecord;
*/
public class CLogFile extends Handler
{
/**
* Get File Logger
* @param create create if not exists
* @param adempiereHome adempiere home
* @param isClient client
* @return file logger
*/
public static CLogFile get (boolean create, String adempiereHome, boolean isClient)
{
if (s_logFile == null && create)
s_logFile = new CLogFile(adempiereHome, true, isClient);
return s_logFile;
} // get
private static CLogFile s_logFile = null;
/**************************************************************************
* Constructor
* @param adempiereHome adempiere home
@ -57,12 +41,6 @@ public class CLogFile extends Handler
*/
public CLogFile (String adempiereHome, boolean createLogDir, boolean isClient)
{
if (s_logFile == null)
s_logFile = this;
else
reportError("File Handler exists already",
new IllegalStateException("Existing Handler"),
ErrorManager.GENERIC_FAILURE);
//
if (adempiereHome != null && adempiereHome.length() > 0)
m_adempiereHome = adempiereHome;
@ -162,6 +140,8 @@ public class CLogFile extends Handler
fileName += File.separator;
if (isClient)
fileName += "client";
else
fileName += (CLogMgt.getRootLoggerName() +".");
m_fileNameDate = getFileNameDate(System.currentTimeMillis());
fileName += m_fileNameDate + "_";
for (int i = 0; i < 100; i++)
@ -371,4 +351,20 @@ public class CLogFile extends Handler
return sb.toString ();
} // toString
public static CLogFile get(boolean create, String adempiereHome, boolean isClient) {
Handler[] handlers = CLogMgt.getHandlers();
for (Handler handler : handlers)
{
if (handler instanceof CLogFile)
return (CLogFile) handler;
}
if (create)
{
CLogFile handler = new CLogFile(adempiereHome, true, isClient);
CLogMgt.addHandler(handler);
return handler;
}
return null;
}
} // CLogFile

View File

@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
@ -47,15 +48,15 @@ import org.compiere.model.MClient;
*/
public class CLogMgt
{
public static final String DEFAULT_ROOT_LOGGER_NAME = "adempiere";
public static final String ROOT_LOGGER_NAME_PROPERTY = "org.adempiere.log.root";
/**
* Initialize Logging
* @param isClient client
*/
public static void initialize(boolean isClient)
{
if (s_handlers != null)
return;
if (isClient)
{
LogManager mgr = LogManager.getLogManager();
@ -73,18 +74,17 @@ public class CLogMgt
}
}
// Create Handler List
s_handlers = new ArrayList<Handler>();
// Handler List
List<String>handlerNames = new ArrayList<String>();
try
{
Logger rootLogger = Logger.getLogger("");
Logger rootLogger = Logger.getLogger(getRootLoggerName());
rootLogger.setUseParentHandlers(false);
// System.out.println(rootLogger.getName() + " (" + rootLogger + ")");
Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i ++)
{
// System.out.println(" > " + handlers[i]);
if (!s_handlers.contains(handlers[i]))
s_handlers.add(handlers[i]);
handlerNames.add(handlers[i].getClass().getName());
}
/**
Enumeration en = mgr.getLoggerNames();
@ -144,21 +144,16 @@ public class CLogMgt
else
System.err.println(e.toString());
}
// System.out.println("Handlers=" + s_handlers.size());
// Check Loggers
if (CLogErrorBuffer.get(false) == null)
addHandler(CLogErrorBuffer.get(true));
if (CLogConsole.get(false) == null)
addHandler(CLogConsole.get(true));
CLogFile fh = CLogFile.get (false, null, isClient);
if (fh == null && !isClient)
if (!handlerNames.contains(CLogErrorBuffer.class.getName()))
addHandler(new CLogErrorBuffer());
if (!handlerNames.contains(CLogConsole.class.getName()))
addHandler(new CLogConsole());
if (!handlerNames.contains(CLogFile.class.getName()))
{
fh = CLogFile.get (true, null, isClient);
Handler fh = new CLogFile(null, true, isClient);
addHandler(fh);
}
if (fh != null && !isClient)
System.out.println(fh);
setFormatter(CLogFormatter.get());
setFilter(CLogFilter.get());
@ -170,10 +165,13 @@ public class CLogMgt
} // initialize
/** Handlers */
private static ArrayList<Handler> s_handlers = null;
/** Current Log Level */
private static Level s_currentLevel = Level.INFO;
public static String getRootLoggerName() {
String root = Env.getCtx().getProperty(ROOT_LOGGER_NAME_PROPERTY);
if (root == null || root.trim().length() == 0)
root = DEFAULT_ROOT_LOGGER_NAME;
return root;
}
/** Logger */
private static Logger log = Logger.getAnonymousLogger();
@ -191,9 +189,9 @@ public class CLogMgt
*/
protected static Handler[] getHandlers()
{
Handler[] handlers = new Handler[s_handlers.size()];
for (int i = 0; i < s_handlers.size(); i++)
handlers[i] = (Handler)s_handlers.get(i);
Logger rootLogger = Logger.getLogger(getRootLoggerName());
rootLogger.setUseParentHandlers(false);
Handler[] handlers = rootLogger.getHandlers();
return handlers;
} // getHandlers
@ -205,10 +203,9 @@ public class CLogMgt
{
if (handler == null)
return;
Logger rootLogger = Logger.getLogger("");
Logger rootLogger = Logger.getLogger(getRootLoggerName());
rootLogger.addHandler(handler);
//
s_handlers.add(handler);
log.log(Level.CONFIG, "Handler=" + handler);
} // addHandler
@ -219,10 +216,12 @@ public class CLogMgt
*/
protected static void setFormatter (java.util.logging.Formatter formatter)
{
for (int i = 0; i < s_handlers.size(); i++)
Logger rootLogger = Logger.getLogger(getRootLoggerName());
rootLogger.setUseParentHandlers(false);
Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++)
{
Handler handler = (Handler)s_handlers.get(i);
handler.setFormatter(formatter);
handlers[i].setFormatter(formatter);
}
log.log(Level.CONFIG, "Formatter=" + formatter);
} // setFormatter
@ -233,10 +232,12 @@ public class CLogMgt
*/
protected static void setFilter (Filter filter)
{
for (int i = 0; i < s_handlers.size(); i++)
Logger rootLogger = Logger.getLogger(getRootLoggerName());
rootLogger.setUseParentHandlers(false);
Handler[] handlers = rootLogger.getHandlers();
for (int i = 0; i < handlers.length; i++)
{
Handler handler = (Handler)s_handlers.get(i);
handler.setFilter(filter);
handlers[i].setFilter(filter);
}
log.log(Level.CONFIG, "Filter=" + filter);
} // setFilter
@ -272,23 +273,22 @@ public class CLogMgt
{
if (level == null)
return;
if (s_handlers == null)
initialize(true);
//
for (int i = 0; i < s_handlers.size(); i++)
Logger rootLogger = Logger.getLogger(getRootLoggerName());
rootLogger.setUseParentHandlers(false);
Handler[] handlers = rootLogger.getHandlers();
if (handlers == null || handlers.length == 0)
{
Handler handler = (Handler)s_handlers.get(i);
handler.setLevel(level);
initialize(true);
handlers = rootLogger.getHandlers();
}
//
for (int i = 0; i < handlers.length; i++)
{
handlers[i].setLevel(level);
}
// JDBC if ALL
setJDBCDebug(s_currentLevel.intValue() == Level.ALL.intValue());
setJDBCDebug(level.intValue() == Level.ALL.intValue());
//
if (level.intValue() != s_currentLevel.intValue())
{
setLoggerLevel(level, null);
log.config(level.toString());
}
s_currentLevel = level;
} // setHandlerLevel
/**
@ -338,7 +338,8 @@ public class CLogMgt
*/
public static Level getLevel()
{
return s_currentLevel;
Logger rootLogger = Logger.getLogger(getRootLoggerName());
return rootLogger.getLevel();
} // getLevel
/**
@ -347,7 +348,8 @@ public class CLogMgt
*/
public static int getLevelAsInt()
{
return s_currentLevel.intValue();
Logger rootLogger = Logger.getLogger(getRootLoggerName());
return rootLogger.getLevel().intValue();
} // getLevel
/**
@ -359,7 +361,7 @@ public class CLogMgt
{
if (level == null)
return false;
return level.intValue() >= s_currentLevel.intValue();
return level.intValue() >= getLevelAsInt();
} // isLevel
/**
@ -368,7 +370,7 @@ public class CLogMgt
*/
public static boolean isLevelAll ()
{
return Level.ALL.intValue() == s_currentLevel.intValue();
return Level.ALL.intValue() == getLevelAsInt();
} // isLevelFinest
/**
@ -377,7 +379,7 @@ public class CLogMgt
*/
public static boolean isLevelFinest ()
{
return Level.FINEST.intValue() >= s_currentLevel.intValue();
return Level.FINEST.intValue() >= getLevelAsInt();
} // isLevelFinest
/**
@ -386,7 +388,7 @@ public class CLogMgt
*/
public static boolean isLevelFiner ()
{
return Level.FINER.intValue() >= s_currentLevel.intValue();
return Level.FINER.intValue() >= getLevelAsInt();
} // isLevelFiner
/**
@ -395,7 +397,7 @@ public class CLogMgt
*/
public static boolean isLevelFine ()
{
return Level.FINE.intValue() >= s_currentLevel.intValue();
return Level.FINE.intValue() >= getLevelAsInt();
} // isLevelFine
/**
@ -404,7 +406,7 @@ public class CLogMgt
*/
public static boolean isLevelInfo ()
{
return Level.INFO.intValue() >= s_currentLevel.intValue();
return Level.INFO.intValue() >= getLevelAsInt();
} // isLevelFine
/**
@ -413,13 +415,14 @@ public class CLogMgt
*/
public static void enable (boolean enableLogging)
{
Logger rootLogger = Logger.getLogger(getRootLoggerName());
rootLogger.setUseParentHandlers(false);
if (enableLogging)
setLevel(s_currentLevel);
setLevel(rootLogger.getLevel());
else
{
Level level = s_currentLevel;
setLevel(Level.OFF);
s_currentLevel = level;
}
} // enable
@ -450,8 +453,7 @@ public class CLogMgt
log.info(description + " - Size=" + p.size()
+ ", Hash=" + p.hashCode() + "\n" + getLocalHost());
else
System.out.println("Log.printProperties = " + description + ", Size=" + p.size()
+ ", Hash=" + p.hashCode() + "\n" + getLocalHost());
System.out.println("Log.printProperties = " + description + ", Size=" + p.size());
Object[] pp = p.keySet().toArray();
Arrays.sort(pp);

View File

@ -48,8 +48,10 @@ public class CLogger extends Logger implements Serializable
{
// CLogMgt.initialize();
LogManager manager = LogManager.getLogManager();
if (className == null)
className = "";
if (className == null || className.trim().length() == 0)
className = CLogMgt.getRootLoggerName();
else
className = CLogMgt.getRootLoggerName() + "." + className;
Logger result = manager.getLogger(className);
if (result != null && result instanceof CLogger)
return (CLogger)result;

View File

@ -70,9 +70,6 @@ import org.compiere.swing.CFrame;
*/
public final class Env
{
/** Logging */
private static CLogger s_log = CLogger.getCLogger(Env.class);
private final static ContextProvider clientContextProvider = new DefaultContextProvider();
/**
@ -98,7 +95,6 @@ public final class Env
}
//
reset(true); // final cache reset
s_log.info("");
//
CLogMgt.shutdown();
//
@ -128,7 +124,6 @@ public final class Env
*/
public static void reset (boolean finalCall)
{
s_log.info("finalCall=" + finalCall);
if (Ini.isClient())
{
closeWindows();
@ -243,7 +238,7 @@ public final class Env
{
if (ctx == null || context == null)
return;
s_log.finer("Context " + context + "==" + value);
getLogger().finer("Context " + context + "==" + value);
//
if (value == null || value.length() == 0)
ctx.remove(context);
@ -251,6 +246,10 @@ public final class Env
ctx.setProperty(context, value);
} // setContext
private static CLogger getLogger() {
return CLogger.getCLogger(Env.class.getName());
}
/**
* Set Global Context to Value
* @param ctx context
@ -264,7 +263,7 @@ public final class Env
if (value == null)
{
ctx.remove(context);
s_log.finer("Context " + context + "==" + value);
getLogger().finer("Context " + context + "==" + value);
}
else
{ // JDBC Format 2005-05-09 00:00:00.0
@ -272,7 +271,7 @@ public final class Env
// Chop off .0 (nanos)
stringValue = stringValue.substring(0, stringValue.indexOf("."));
ctx.setProperty(context, stringValue);
s_log.finer("Context " + context + "==" + stringValue);
getLogger().finer("Context " + context + "==" + stringValue);
}
} // setContext
@ -286,7 +285,7 @@ public final class Env
{
if (ctx == null || context == null)
return;
s_log.finer("Context " + context + "==" + value);
getLogger().finer("Context " + context + "==" + value);
//
ctx.setProperty(context, String.valueOf(value));
} // setContext
@ -314,7 +313,7 @@ public final class Env
if (ctx == null || context == null)
return;
if (WindowNo != WINDOW_FIND && WindowNo != WINDOW_MLOOKUP)
s_log.finer("Context("+WindowNo+") " + context + "==" + value);
getLogger().finer("Context("+WindowNo+") " + context + "==" + value);
//
if (value == null || value.equals(""))
ctx.remove(WindowNo+"|"+context);
@ -336,7 +335,7 @@ public final class Env
if (value == null)
{
ctx.remove(WindowNo+"|"+context);
s_log.finer("Context("+WindowNo+") " + context + "==" + value);
getLogger().finer("Context("+WindowNo+") " + context + "==" + value);
}
else
{ // JDBC Format 2005-05-09 00:00:00.0
@ -344,7 +343,7 @@ public final class Env
// Chop off .0 (nanos)
stringValue = stringValue.substring(0, stringValue.indexOf("."));
ctx.setProperty(WindowNo+"|"+context, stringValue);
s_log.finer("Context("+WindowNo+") " + context + "==" + stringValue);
getLogger().finer("Context("+WindowNo+") " + context + "==" + stringValue);
}
} // setContext
@ -360,7 +359,7 @@ public final class Env
if (ctx == null || context == null)
return;
if (WindowNo != WINDOW_FIND && WindowNo != WINDOW_MLOOKUP)
s_log.finer("Context("+WindowNo+") " + context + "==" + value);
getLogger().finer("Context("+WindowNo+") " + context + "==" + value);
//
ctx.setProperty(WindowNo+"|"+context, String.valueOf(value));
} // setContext
@ -390,7 +389,7 @@ public final class Env
if (ctx == null || context == null)
return;
if (WindowNo != WINDOW_FIND && WindowNo != WINDOW_MLOOKUP)
s_log.finest("Context("+WindowNo+","+TabNo+") " + context + "==" + value);
getLogger().finest("Context("+WindowNo+","+TabNo+") " + context + "==" + value);
//
if (value == null)
if (context.endsWith("_ID"))
@ -607,7 +606,7 @@ public final class Env
}
catch (NumberFormatException e)
{
s_log.log(Level.SEVERE, "(" + context + ") = " + s, e);
getLogger().log(Level.SEVERE, "(" + context + ") = " + s, e);
}
return 0;
} // getContextAsInt
@ -631,7 +630,7 @@ public final class Env
}
catch (NumberFormatException e)
{
s_log.log(Level.SEVERE, "(" + context + ") = " + s, e);
getLogger().log(Level.SEVERE, "(" + context + ") = " + s, e);
}
return 0;
} // getContextAsInt
@ -656,7 +655,7 @@ public final class Env
}
catch (NumberFormatException e)
{
s_log.log(Level.SEVERE, "(" + context + ") = " + s, e);
getLogger().log(Level.SEVERE, "(" + context + ") = " + s, e);
}
return 0;
} // getContextAsInt
@ -681,7 +680,7 @@ public final class Env
}
catch (NumberFormatException e)
{
s_log.log(Level.SEVERE, "(" + context + ") = " + s, e);
getLogger().log(Level.SEVERE, "(" + context + ") = " + s, e);
}
return 0;
} // getContextAsInt
@ -815,7 +814,7 @@ public final class Env
// JDBC Format YYYY-MM-DD example 2000-09-11 00:00:00.0
if (s == null || s.equals(""))
{
s_log.log(Level.SEVERE, "No value for: " + context);
getLogger().log(Level.SEVERE, "No value for: " + context);
return new Timestamp(System.currentTimeMillis());
}
@ -1068,7 +1067,7 @@ public final class Env
}
catch (SQLException e)
{
s_log.log(Level.SEVERE, "", e);
getLogger().log(Level.SEVERE, "", e);
}
finally {
DB.close(rs, pstmt);
@ -1080,7 +1079,7 @@ public final class Env
// No Language - set to System
if (AD_Languages.size() == 0)
{
s_log.warning ("NO System Language - Set to Base " + Language.getBaseAD_Language());
getLogger().warning ("NO System Language - Set to Base " + Language.getBaseAD_Language());
language.setAD_Language(Language.getBaseAD_Language());
return;
}
@ -1093,7 +1092,7 @@ public final class Env
String langCompare = language.getAD_Language().substring(0, 2);
if (lang.equals(langCompare))
{
s_log.fine("Found similar Language " + AD_Language);
getLogger().fine("Found similar Language " + AD_Language);
language.setAD_Language(AD_Language);
return;
}
@ -1102,7 +1101,7 @@ public final class Env
// We found same language
// if (!"0".equals(Msg.getMsg(AD_Language, "0")))
s_log.warning ("Not System Language=" + language
getLogger().warning ("Not System Language=" + language
+ " - Set to Base Language " + Language.getBaseAD_Language());
language.setAD_Language(Language.getBaseAD_Language());
} // verifyLanguage
@ -1226,7 +1225,7 @@ public final class Env
int j = inStr.indexOf('@'); // next @
if (j < 0)
{
s_log.log(Level.SEVERE, "No second tag: " + inStr);
getLogger().log(Level.SEVERE, "No second tag: " + inStr);
return ""; // no second tag
}
@ -1237,7 +1236,7 @@ public final class Env
ctxInfo = getContext(ctx, token); // get global context
if (ctxInfo.length() == 0)
{
s_log.config("No Context Win=" + WindowNo + " for: " + token);
getLogger().config("No Context Win=" + WindowNo + " for: " + token);
if (!ignoreUnparsable)
return ""; // token not found
}
@ -1291,7 +1290,7 @@ public final class Env
int j = inStr.indexOf('@'); // next @
if (j < 0)
{
s_log.log(Level.SEVERE, "No second tag: " + inStr);
getLogger().log(Level.SEVERE, "No second tag: " + inStr);
return ""; // no second tag
}
@ -1410,7 +1409,7 @@ public final class Env
}
catch (Exception e)
{
s_log.log(Level.SEVERE, e.toString());
getLogger().log(Level.SEVERE, e.toString());
}
return retValue;
} // getWindow
@ -1513,7 +1512,7 @@ public final class Env
// URL url = Adempiere.class.getResource("images/" + fileNameInImageDir);
if (url == null)
{
s_log.log(Level.SEVERE, "Not found: " + fileNameInImageDir);
getLogger().log(Level.SEVERE, "Not found: " + fileNameInImageDir);
return null;
}
Toolkit tk = Toolkit.getDefaultToolkit();
@ -1533,7 +1532,7 @@ public final class Env
// URL url = Adempiere.class.getResource("images/" + fileNameInImageDir);
if (url == null)
{
s_log.log(Level.INFO, "Not found: " + fileNameInImageDir);
getLogger().log(Level.INFO, "Not found: " + fileNameInImageDir);
return null;
}
return new ImageIcon(url);
@ -1558,7 +1557,7 @@ public final class Env
// url = Adempiere.class.getResource("images/" + fileName+".png");
if (url == null)
{
s_log.log(Level.INFO, "GIF/PNG Not found: " + fileName);
getLogger().log(Level.INFO, "GIF/PNG Not found: " + fileName);
return null;
}
return new ImageIcon(url);
@ -1571,7 +1570,7 @@ public final class Env
*/
public static void startBrowser (String url)
{
s_log.info(url);
getLogger().info(url);
getContextProvider().showURL(url);
} // startBrowser
@ -1615,7 +1614,7 @@ public final class Env
for (int i = 0; i < s_hiddenWindows.size(); i++)
{
CFrame hidden = s_hiddenWindows.get(i);
s_log.info(i + ": " + hidden);
getLogger().info(i + ": " + hidden);
if (hidden.getAD_Window_ID() == window.getAD_Window_ID())
return false; // already there
}
@ -1624,7 +1623,7 @@ public final class Env
if (s_hiddenWindows.add(window))
{
window.setVisible(false);
s_log.info(window.toString());
getLogger().info(window.toString());
// window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_ICONIFIED));
if (s_hiddenWindows.size() > 10) {
CFrame toClose = s_hiddenWindows.remove(0); // sort of lru
@ -1654,7 +1653,7 @@ public final class Env
if (hidden.getAD_Window_ID() == AD_Window_ID)
{
s_hiddenWindows.remove(i);
s_log.info(hidden.toString());
getLogger().info(hidden.toString());
hidden.setVisible(true);
// De-iconify window - teo_sarca [ 1707221 ]
int state = hidden.getExtendedState();
@ -1689,16 +1688,16 @@ public final class Env
*/
public static void sleep (int sec)
{
s_log.info("Start - Seconds=" + sec);
getLogger().info("Start - Seconds=" + sec);
try
{
Thread.sleep(sec*1000);
}
catch (Exception e)
{
s_log.log(Level.WARNING, "", e);
getLogger().log(Level.WARNING, "", e);
}
s_log.info("End");
getLogger().info("End");
} // sleep
/**

View File

@ -95,9 +95,8 @@ public final class AdempiereClient
// Set up Log
CLogMgt.setLevel(Ini.getProperty(Ini.P_TRACELEVEL));
if (isClient && Ini.isPropertyBool(Ini.P_TRACEFILE)
&& CLogFile.get(false, null, isClient) == null)
CLogMgt.addHandler(CLogFile.get (true, Ini.findAdempiereHome(), isClient));
if (isClient && Ini.isPropertyBool(Ini.P_TRACEFILE))
CLogMgt.addHandler(new CLogFile(Ini.findAdempiereHome(), true, isClient));
// Set UI
if (isClient)

View File

@ -22,6 +22,7 @@ import java.util.Properties;
import javax.servlet.http.HttpSession;
import org.compiere.util.CLogMgt;
import org.compiere.util.Env;
import org.zkoss.util.Locales;
import org.zkoss.zk.ui.Component;
@ -80,7 +81,7 @@ public class SessionContextListener implements ExecutionInit,
SessionManager.getAppDesktop().showURL(url, true);
}
});
ctx.put(CLogMgt.ROOT_LOGGER_NAME_PROPERTY, "org.adempiere.webui");
ctx.setProperty(SERVLET_SESSION_ID, httpSession.getId());
session.setAttribute(SESSION_CTX, ctx);
}

View File

@ -33,6 +33,7 @@ import org.adempiere.webui.window.ZkReportViewerProvider;
import org.compiere.Adempiere;
import org.compiere.print.ReportCtl;
import org.compiere.report.ReportStarter;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.Ini;
import org.zkoss.zk.ui.http.DHtmlLayoutServlet;
@ -69,6 +70,7 @@ public class WebUIServlet extends DHtmlLayoutServlet
SessionManager.getAppDesktop().showURL(url, true);
}
});
serverContext.put(CLogMgt.ROOT_LOGGER_NAME_PROPERTY, "org.adempiere.webui");
ServerContext.setCurrentInstance(serverContext);
boolean started = Adempiere.startup(false);