* 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

@ -51,7 +51,7 @@ import org.compiere.util.Util;
*
* @author Jorg Janke
* @version $Id: Adempiere.java,v 1.8 2006/08/11 02:58:14 jjanke Exp $
*
*
*/
public final class Adempiere
{
@ -95,7 +95,7 @@ public final class Adempiere
static private Image s_imageLogo;
static private ImageIcon s_imageIcon32;
static private ImageIcon s_imageIconLogo;
static private final String ONLINE_HELP_URL = "http://www.adempiere.com/wiki/index.php/Manual";
/** Logging */
@ -118,12 +118,12 @@ public final class Adempiere
if (properties.containsKey("IMPLEMENTATION_VERSION"))
s_ImplementationVersion = properties.getProperty("IMPLEMENTATION_VERSION");
if (properties.containsKey("IMPLEMENTATION_VENDOR"))
s_ImplementationVendor = properties.getProperty("IMPLEMENTATION_VENDOR");
s_ImplementationVendor = properties.getProperty("IMPLEMENTATION_VENDOR");
} catch (IOException e) {
}
}
}
/**
* Get Product Name
* @return Application Name
@ -244,7 +244,7 @@ public final class Adempiere
*/
public static String getJavaInfo()
{
return System.getProperty("java.vm.name")
return System.getProperty("java.vm.name")
+ " " + System.getProperty("java.vm.version");
} // getJavaInfo
@ -254,8 +254,8 @@ public final class Adempiere
*/
public static String getOSInfo()
{
return System.getProperty("os.name") + " "
+ System.getProperty("os.version") + " "
return System.getProperty("os.name") + " "
+ System.getProperty("os.version") + " "
+ System.getProperty("sun.os.patch.level");
} // getJavaInfo
@ -267,7 +267,7 @@ public final class Adempiere
{
return "http://" + URL;
} // getURL
/**
* @return URL
*/
@ -425,16 +425,16 @@ public final class Adempiere
{
try
{
BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
URL url = bs.getCodeBase();
return url;
}
catch(UnavailableServiceException ue)
}
catch(UnavailableServiceException ue)
{
return null;
}
return null;
}
} // getCodeBase
/**
* @return True if client is started using web start
*/
@ -488,18 +488,17 @@ public final class Adempiere
// System properties
Ini.loadProperties (false);
// 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)
{
if (CLogMgt.isLevelAll())
log.log(Level.FINEST, System.getProperties().toString());
log.log(Level.FINEST, System.getProperties().toString());
}
// Set Default Database Connection from Ini
@ -507,7 +506,7 @@ public final class Adempiere
if (isClient) // don't test connection
return false; // need to call
return startupEnvironment(isClient);
} // startup
@ -529,7 +528,7 @@ public final class Adempiere
MSystem system = MSystem.get(Env.getCtx()); // Initializes Base Context too
if (system == null)
return false;
// Initialize main cached Singletons
ModelValidationEngine.get();
try
@ -547,9 +546,9 @@ public final class Adempiere
}
}
SecureEngine.init(className);
//
if (isClient)
if (isClient)
MClient.get(Env.getCtx(),0); // Login Client loaded later
else
MClient.getAll(Env.getCtx());
@ -558,7 +557,7 @@ public final class Adempiere
{
log.warning("Environment problems: " + e.toString());
}
// Start Workflow Document Manager (in other package) for PO
String className = null;
try
@ -573,7 +572,7 @@ public final class Adempiere
{
log.warning("Not started: " + className + " - " + e.getMessage());
}
if (!isClient)
DB.updateMail();
return true;

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
@ -77,12 +57,12 @@ public class CLogConsole extends Handler
String encoding = getEncoding();
if (encoding != null)
{
try
try
{
m_writerOut = new PrintWriter(new OutputStreamWriter(System.out, encoding));
m_writerErr = new PrintWriter(new OutputStreamWriter(System.err, encoding));
}
catch (UnsupportedEncodingException ex)
catch (UnsupportedEncodingException ex)
{
reportError ("Opening encoded Writers", ex, ErrorManager.OPEN_FAILURE);
}
@ -91,7 +71,7 @@ public class CLogConsole extends Handler
m_writerOut = new PrintWriter(System.out);
if (m_writerErr == null)
m_writerErr = new PrintWriter(System.err);
// Formatting
setFormatter(CLogFormatter.get());
// Default Level
@ -100,7 +80,7 @@ public class CLogConsole extends Handler
setFilter(CLogFilter.get());
//
} // initialize
/**
* Set Encoding
* @param encoding encoding
@ -116,7 +96,7 @@ public class CLogConsole extends Handler
initialize();
} // setEncoding
/**
* Set Level
* @see java.util.logging.Handler#setLevel(java.util.logging.Level)
@ -135,7 +115,7 @@ public class CLogConsole extends Handler
else
DriverManager.setLogWriter(null);
} // setLevel
/**
* Publish
* @see java.util.logging.Handler#publish(java.util.logging.LogRecord)
@ -145,7 +125,7 @@ public class CLogConsole extends Handler
{
if (!isLoggable (record) || m_writerOut == null)
return;
// Format
String msg = null;
try
@ -165,7 +145,7 @@ public class CLogConsole extends Handler
m_writerOut.write (getFormatter().getHead (this));
m_doneHeader = true;
}
if (record.getLevel() == Level.SEVERE
if (record.getLevel() == Level.SEVERE
|| record.getLevel() == Level.WARNING)
{
flush();
@ -212,7 +192,7 @@ public class CLogConsole extends Handler
/**
* Close
*
*
* @see java.util.logging.Handler#close()
* @throws SecurityException
*/
@ -255,7 +235,7 @@ public class CLogConsole extends Handler
}
m_writerErr = null;
} // close
/**
* String Representation
* @return info

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;
@ -30,10 +29,10 @@ import org.compiere.model.MIssue;
/**
* Client Error Buffer
*
*
* @author Jorg Janke
* @version $Id: CLogErrorBuffer.java,v 1.3 2006/07/30 00:54:36 jjanke Exp $
*
*
* @author Teo Sarca, teo.sarca@gmail.com
* <li>BF [ 2973298 ] NPE on CLogErrorBuffer
*/
@ -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
@ -80,7 +57,7 @@ public class CLogErrorBuffer extends Handler
/** Log Size */
private static final int LOG_SIZE = 100;
/**
* Initialize
*/
@ -103,14 +80,14 @@ public class CLogErrorBuffer extends Handler
public boolean isIssueError()
{
Boolean b = (Boolean) Env.getCtx().get(ISSUE_ERROR_KEY);
if (b == null)
if (b == null)
{
b = Boolean.TRUE;
b = Boolean.TRUE;
setIssueError(b);
}
return b;
} // isIssueError
/**
* Set Issue Error
* @param issueError issue error
@ -119,7 +96,7 @@ public class CLogErrorBuffer extends Handler
{
Env.getCtx().put(ISSUE_ERROR_KEY, issueError);
} // setIssueError
/**
* Set Level.
* Ignore OFF - and higher then FINE
@ -139,7 +116,7 @@ public class CLogErrorBuffer extends Handler
else
super.setLevel(newLevel);
} // SetLevel
/**
* Publish
* @see java.util.logging.Handler#publish(java.util.logging.LogRecord)
@ -148,11 +125,11 @@ public class CLogErrorBuffer extends Handler
public void publish (LogRecord record)
{
checkContext();
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
if (!isLoggable (record) || m_logs == null)
return;
// Output
synchronized (m_logs)
{
@ -160,7 +137,7 @@ public class CLogErrorBuffer extends Handler
m_logs.removeFirst();
m_logs.add(record);
}
// We have an error
if (record.getLevel() == Level.SEVERE)
{
@ -174,7 +151,7 @@ public class CLogErrorBuffer extends Handler
// Add Error
m_errors.add(record);
record.getSourceClassName(); // forces Class Name eval
// Create History
ArrayList<LogRecord> history = new ArrayList<LogRecord>();
for (int i = m_logs.size()-1; i >= 0; i--)
@ -193,11 +170,11 @@ public class CLogErrorBuffer extends Handler
if (history.size() > 10)
break; // no more then 10 history records
}
}
LogRecord[] historyArray = new LogRecord[history.size()];
int no = 0;
for (int i = history.size()-1; i >= 0; i--)
for (int i = history.size()-1; i >= 0; i--)
historyArray[no++] = (LogRecord)history.get(i);
m_history.add(historyArray);
// Issue Reporting
@ -207,8 +184,8 @@ public class CLogErrorBuffer extends Handler
if (loggerName == null)
loggerName = "";
String className = record.getSourceClassName(); // physical class
String methodName = record.getSourceMethodName(); //
if (DB.isConnected(false)
String methodName = record.getSourceMethodName(); //
if (DB.isConnected(false)
&& !methodName.equals("saveError")
&& !methodName.equals("get_Value")
&& !methodName.equals("dataSave")
@ -217,7 +194,7 @@ public class CLogErrorBuffer extends Handler
)
{
setIssueError(false);
try
try
{
MIssue.create(record);
setIssueError(true);
@ -264,12 +241,12 @@ public class CLogErrorBuffer extends Handler
Env.getCtx().remove(HISTORY_KEY);
} // close
/**************************************************************************
* Get ColumnNames of Log Entries
* @param ctx context (not used)
* @return string vector
*/
*/
public Vector<String> getColumnNames(Properties ctx)
{
Vector<String> cn = new Vector<String>();
@ -295,7 +272,7 @@ public class CLogErrorBuffer extends Handler
LogRecord[] records = getRecords(errorsOnly);
// System.out.println("getLogData - " + events.length);
Vector<Vector<Object>> rows = new Vector<Vector<Object>>(records.length);
for (int i = 0; i < records.length; i++)
{
LogRecord record = records[i];
@ -314,16 +291,16 @@ public class CLogErrorBuffer extends Handler
}
return rows;
} // getData
/**
* Get Array of events with most recent first
* @param errorsOnly if true errors otherwise log
* @return array of events
* @return array of events
*/
public LogRecord[] getRecords (boolean errorsOnly)
{
checkContext();
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
LinkedList<LogRecord> m_errors = (LinkedList<LogRecord>) Env.getCtx().get(ERRORS_KEY);
LogRecord[] retValue = null;
@ -345,7 +322,7 @@ public class CLogErrorBuffer extends Handler
}
return retValue;
} // getEvents
/**
* Reset Error Buffer
* @param errorsOnly if true errors otherwise log
@ -353,7 +330,7 @@ public class CLogErrorBuffer extends Handler
public void resetBuffer (boolean errorsOnly)
{
checkContext();
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
LinkedList<LogRecord> m_errors = (LinkedList<LogRecord>) Env.getCtx().get(ERRORS_KEY);
LinkedList<LogRecord[]> m_history = (LinkedList<LogRecord[]>) Env.getCtx().get(HISTORY_KEY);
@ -370,7 +347,7 @@ public class CLogErrorBuffer extends Handler
}
}
} // resetBuffer
/**
* Get/Put Error Info in String
* @param ctx context
@ -380,7 +357,7 @@ public class CLogErrorBuffer extends Handler
public String getErrorInfo (Properties ctx, boolean errorsOnly)
{
checkContext();
StringBuffer sb = new StringBuffer();
//
if (errorsOnly)
@ -390,7 +367,7 @@ public class CLogErrorBuffer extends Handler
{
sb.append("-------------------------------\n");
LogRecord[] records = (LogRecord[])m_history.get(i);
for (int j = 0; j < records.length; j++)
for (int j = 0; j < records.length; j++)
{
LogRecord record = records[j];
sb.append(getFormatter().format(record));
@ -420,20 +397,20 @@ public class CLogErrorBuffer extends Handler
LinkedList<LogRecord> m_logs = new LinkedList<LogRecord>();
Env.getCtx().put(LOGS_KEY, m_logs);
}
if (!Env.getCtx().containsKey(ERRORS_KEY))
{
LinkedList<LogRecord> m_errors = new LinkedList<LogRecord>();
Env.getCtx().put(ERRORS_KEY, m_errors);
}
if (!Env.getCtx().containsKey(HISTORY_KEY))
{
LinkedList<LogRecord[]> m_history = new LinkedList<LogRecord[]>();
Env.getCtx().put(HISTORY_KEY, m_history);
}
}
/**
* String Representation
* @return info
@ -441,7 +418,7 @@ public class CLogErrorBuffer extends Handler
public String toString ()
{
checkContext();
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
LinkedList<LogRecord> m_errors = (LinkedList<LogRecord>) Env.getCtx().get(ERRORS_KEY);
LinkedList<LogRecord[]> m_history = (LinkedList<LogRecord[]>) Env.getCtx().get(HISTORY_KEY);
@ -453,5 +430,22 @@ public class CLogErrorBuffer extends Handler
.append ("]");
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

@ -27,28 +27,12 @@ import java.util.logging.LogRecord;
/**
* Adempiere Log File Handler
*
*
* @author Jorg Janke
* @version $Id: CLogFile.java,v 1.3 2006/07/30 00:54:35 jjanke Exp $
*/
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;
@ -83,7 +61,7 @@ public class CLogFile extends Handler
private String m_fileNameDate = "";
/** Record Counter */
private int m_records = 0;
/**
* Initialize
* @param adempiereHome log file base directory name
@ -112,7 +90,7 @@ public class CLogFile extends Handler
m_writer = null;
}
// System.out.println(getFileName());
// Formatting
setFormatter(CLogFormatter.get());
// Level
@ -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++)
@ -188,7 +168,7 @@ public class CLogFile extends Handler
}
return true;
} // createFile
/**
* Get File Name Date portion
* @param time time in ms
@ -200,7 +180,7 @@ public class CLogFile extends Handler
String s = ts.toString();
return s.substring(0, 10);
} // getFileNameDate
/**
* Rotate Log when day changes
* @param time time
@ -212,7 +192,7 @@ public class CLogFile extends Handler
return;
rotateLog();
} // rotateLog
/**
* Rotate Log
* Called after Initialization
@ -221,7 +201,7 @@ public class CLogFile extends Handler
{
initialize(m_adempiereHome, true, Ini.isClient());
} // rotateLog
/**
* Get File Name
* @return file name
@ -243,8 +223,8 @@ public class CLogFile extends Handler
return m_file.getParentFile();
return null;
} // getLogDirectory
/**
* Set Level
* @see java.util.logging.Handler#setLevel(java.util.logging.Level)
@ -268,9 +248,9 @@ public class CLogFile extends Handler
{
if (!isLoggable (record) || m_writer == null)
return;
rotateLog(record.getMillis());
// Format
String msg = null;
try
@ -331,7 +311,7 @@ public class CLogFile extends Handler
{
if (m_writer == null)
return;
// Write Tail
try
{
@ -358,7 +338,7 @@ public class CLogFile extends Handler
m_writer = null;
m_file = null;
} // close
/**
* String Representation
* @return info
@ -370,5 +350,21 @@ public class CLogFile extends Handler
.append ("]");
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;
@ -41,25 +42,25 @@ import org.compiere.model.MClient;
/**
* Adempiere Log Management.
*
*
* @author Jorg Janke
* @version $Id: CLogMgt.java,v 1.4 2006/07/30 00:54:36 jjanke Exp $
*/
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();
try
try
{ // Load Logging config from org.compiere.util.*properties
String fileName = "logClient.properties";
InputStream in = CLogMgt.class.getResourceAsStream(fileName);
@ -72,19 +73,18 @@ public class CLogMgt
e.printStackTrace();
}
}
// 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,22 +144,17 @@ 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());
// setLevel(s_currentLevel);
@ -169,19 +164,22 @@ public class CLogMgt
// System.out.println("Handlers=" + s_handlers.size() + ", Level=" + s_currentLevel);
} // 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();
/** LOG Levels */
public static final Level[] LEVELS = new Level[]
public static final Level[] LEVELS = new Level[]
{Level.OFF, Level.SEVERE, Level.WARNING, Level.INFO,
Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, Level.ALL};
/** New Line */
private static final String NL = System.getProperty("line.separator");
@ -191,12 +189,12 @@ 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
/**
* Add Handler (to root logger)
* @param handler new Handler
@ -205,24 +203,25 @@ 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
/**
* Set Formatter for all handlers
* @param formatter formatter
*/
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
@ -255,7 +256,7 @@ public class CLogMgt
while (en.hasMoreElements())
{
String name = en.nextElement().toString();
if (loggerNamePart == null
if (loggerNamePart == null
|| name.indexOf(loggerNamePart) != -1)
{
Logger lll = Logger.getLogger(name);
@ -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
/**
@ -299,7 +299,7 @@ public class CLogMgt
{
setLevel(String.valueOf(intLevel));
} // setLevel
/**
* Set Level
* @param levelString string representation of level
@ -309,9 +309,9 @@ public class CLogMgt
if (levelString == null)
return;
//
for (int i = 0; i < LEVELS.length; i++)
for (int i = 0; i < LEVELS.length; i++)
{
if (LEVELS[i].getName().equals(levelString))
if (LEVELS[i].getName().equals(levelString))
{
setLevel(LEVELS[i]);
return;
@ -331,25 +331,27 @@ public class CLogMgt
else
DriverManager.setLogWriter(null);
} // setJDBCDebug
/**
* Get logging Level of handlers
* @return logging level
*/
public static Level getLevel()
{
return s_currentLevel;
Logger rootLogger = Logger.getLogger(getRootLoggerName());
return rootLogger.getLevel();
} // getLevel
/**
* Get logging Level of handlers
* @return logging level
*/
public static int getLevelAsInt()
{
return s_currentLevel.intValue();
Logger rootLogger = Logger.getLogger(getRootLoggerName());
return rootLogger.getLevel().intValue();
} // getLevel
/**
* Is Logging Level logged
* @param level level
@ -359,16 +361,16 @@ public class CLogMgt
{
if (level == null)
return false;
return level.intValue() >= s_currentLevel.intValue();
return level.intValue() >= getLevelAsInt();
} // isLevel
/**
* Is Logging Level FINEST logged
* @return true if it is logged
*/
public static boolean isLevelAll ()
{
return Level.ALL.intValue() == s_currentLevel.intValue();
return Level.ALL.intValue() == getLevelAsInt();
} // isLevelFinest
/**
@ -377,25 +379,25 @@ public class CLogMgt
*/
public static boolean isLevelFinest ()
{
return Level.FINEST.intValue() >= s_currentLevel.intValue();
return Level.FINEST.intValue() >= getLevelAsInt();
} // isLevelFinest
/**
* Is Logging Level FINER logged
* @return true if it is logged
*/
public static boolean isLevelFiner ()
{
return Level.FINER.intValue() >= s_currentLevel.intValue();
return Level.FINER.intValue() >= getLevelAsInt();
} // isLevelFiner
/**
* Is Logging Level FINE logged
* @return true if it is logged
*/
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,18 +415,19 @@ 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
/**
* Shutdown Logging system
*/
@ -433,8 +436,8 @@ public class CLogMgt
LogManager mgr = LogManager.getLogManager();
mgr.reset();
} // shutdown
/**
* Print Properties
*
@ -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);
@ -466,7 +468,7 @@ public class CLogMgt
}
} // printProperties
/**
* Get Adempiere System Info
* @param sb buffer to append or null
@ -523,13 +525,13 @@ public class CLogMgt
sb.append(Adempiere.getJavaInfo()).append(NL);
sb.append("java.io.tmpdir="+System.getProperty("java.io.tmpdir")).append(NL);
sb.append(Adempiere.getOSInfo()).append(NL);
//report memory info
Runtime runtime = Runtime.getRuntime();
Runtime runtime = Runtime.getRuntime();
//max heap size
sb.append("Max Heap = "+formatMemoryInfo(runtime.maxMemory())).append(NL);
sb.append("Max Heap = "+formatMemoryInfo(runtime.maxMemory())).append(NL);
//allocated heap size
sb.append("Allocated Heap = "+formatMemoryInfo(runtime.totalMemory())).append(NL);
sb.append("Allocated Heap = "+formatMemoryInfo(runtime.totalMemory())).append(NL);
//free heap size
sb.append("Free Heap = "+formatMemoryInfo(runtime.freeMemory())).append(NL);
//
@ -554,7 +556,7 @@ public class CLogMgt
}
return size + unit;
}
/**
* Create System Info
* @param sb Optional string buffer
@ -653,7 +655,7 @@ public class CLogMgt
return sb.toString();
} // getDatabaseInfo
/**
* Get Localhost
* @return local host
@ -672,7 +674,7 @@ public class CLogMgt
return "-no local host info -";
} // getLocalHost
/**************************************************************************
* CLogMgt
*/
@ -705,7 +707,7 @@ public class CLogMgt
log1.info("thread info");
}
}.start();
try
{
Integer.parseInt("ABC");
@ -717,7 +719,7 @@ public class CLogMgt
log1.log(Level.INFO, "info message 1", "1Param");
log1.log(Level.INFO, "info message n", new Object[]{"1Param","2Param"});
} // testLog
/**
* Test
* @param args ignored

View File

@ -23,14 +23,14 @@ import java.util.logging.Logger;
/**
* Adempiere Logger
*
*
* @author Jorg Janke
* @version $Id: CLogger.java,v 1.3 2006/08/09 16:38:47 jjanke Exp $
*/
public class CLogger extends Logger implements Serializable
{
/**
*
*
*/
private static final long serialVersionUID = 6492376264463028357L;
private static final String LAST_INFO = "org.compiere.util.CLogger.lastInfo";
@ -44,12 +44,14 @@ public class CLogger extends Logger implements Serializable
* @param className class name
* @return Logger
*/
public static synchronized CLogger getCLogger (String className)
public static synchronized CLogger getCLogger (String className)
{
// 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;
@ -83,11 +85,11 @@ public class CLogger extends Logger implements Serializable
s_logger = getCLogger("org.compiere.default");
return s_logger;
} // get
/** Default Logger */
private static CLogger s_logger = null;
/**************************************************************************
* Standard constructor
* @param name logger name
@ -99,7 +101,7 @@ public class CLogger extends Logger implements Serializable
// setLevel(Level.ALL);
} // CLogger
/*************************************************************************/
/**
@ -116,7 +118,7 @@ public class CLogger extends Logger implements Serializable
/**
* Set and issue Error and save as ValueNamePair
* @param AD_Message message key
* @param ex exception
* @param ex exception
* @return true (to avoid removal of method)
*/
public boolean saveError (String AD_Message, Exception ex)
@ -128,8 +130,8 @@ public class CLogger extends Logger implements Serializable
/**
* Set and issue (if specified) Error and save as ValueNamePair
* @param AD_Message message key
* @param ex exception
* @param issueError if true will issue an error
* @param ex exception
* @param issueError if true will issue an error
* @return true (to avoid removal of method)
*/
public boolean saveError (String AD_Message, Exception ex, boolean issueError)
@ -137,7 +139,7 @@ public class CLogger extends Logger implements Serializable
Env.getCtx().put(LAST_EXCEPTION, ex);
return saveError (AD_Message, ex.getLocalizedMessage(), issueError);
} // saveError
/**
* Set Error and save as ValueNamePair
* @param AD_Message message key
@ -161,10 +163,10 @@ public class CLogger extends Logger implements Serializable
*/
public static ValueNamePair retrieveError()
{
ValueNamePair vp = (ValueNamePair) Env.getCtx().remove(LAST_ERROR);
ValueNamePair vp = (ValueNamePair) Env.getCtx().remove(LAST_ERROR);
return vp;
} // retrieveError
/**
* Get Error message from stack
* @param defaultMsg default message (used when there are no errors on stack)
@ -249,7 +251,7 @@ public class CLogger extends Logger implements Serializable
Env.getCtx().remove(LAST_WARNING);
Env.getCtx().remove(LAST_INFO);
} // resetLast
/**
* Get root cause
* @param t
@ -261,10 +263,10 @@ public class CLogger extends Logger implements Serializable
while (cause.getCause() != null)
{
cause = cause.getCause();
}
}
return cause;
}
/**
* String Representation
* @return info
@ -276,7 +278,7 @@ public class CLogger extends Logger implements Serializable
.append (",Level=").append (getLevel()).append ("]");
return sb.toString ();
} // toString
/**
* Write Object - Serialization
* @param out out
@ -287,9 +289,9 @@ public class CLogger extends Logger implements Serializable
out.writeObject(getName());
System.out.println("====writeObject:" + getName());
} // writeObject
private String m_className = null;
private void readObject (ObjectInputStream in) throws IOException
{
try
@ -302,7 +304,7 @@ public class CLogger extends Logger implements Serializable
}
System.out.println("====readObject:" + m_className);
}
protected Object readResolve() throws ObjectStreamException
{
System.out.println("====readResolve:" + m_className);

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

@ -51,7 +51,7 @@ import org.compiere.util.Util;
*
* @author Jorg Janke
* @version $Id: Adempiere.java,v 1.8 2006/08/11 02:58:14 jjanke Exp $
*
*
*/
public final class AdempiereClient
{
@ -92,18 +92,17 @@ public final class AdempiereClient
// System properties
Ini.loadProperties (false);
// 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)
{
if (CLogMgt.isLevelAll())
log.log(Level.FINEST, System.getProperties().toString());
log.log(Level.FINEST, System.getProperties().toString());
}
// Set Default Database Connection from Ini
@ -111,7 +110,7 @@ public final class AdempiereClient
if (isClient) // don't test connection
return false; // need to call
return startupEnvironment(isClient);
} // startup
@ -133,7 +132,7 @@ public final class AdempiereClient
MSystem system = MSystem.get(Env.getCtx()); // Initializes Base Context too
if (system == null)
return false;
// Initialize main cached Singletons
ModelValidationEngine.get();
try
@ -151,9 +150,9 @@ public final class AdempiereClient
}
}
SecureEngine.init(className);
//
if (isClient)
if (isClient)
MClient.get(Env.getCtx(),0); // Login Client loaded later
else
MClient.getAll(Env.getCtx());
@ -162,7 +161,7 @@ public final class AdempiereClient
{
log.warning("Environment problems: " + e.toString());
}
// Start Workflow Document Manager (in other package) for PO
String className = null;
try
@ -177,7 +176,7 @@ public final class AdempiereClient
{
log.warning("Not started: " + className + " - " + e.getMessage());
}
if (!isClient)
DB.updateMail();
return true;

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);