IDEMPIERE-3824 Implement apply packin from folder from command line / avoid the plugin running when started from the PackInFolderApplication / make log level a parameter
This commit is contained in:
parent
e1ce7e9ec9
commit
db714f918e
|
@ -49,12 +49,24 @@ public class PackInFolderApplication implements IApplication {
|
|||
@Override
|
||||
public Object start(IApplicationContext context) throws Exception {
|
||||
Adempiere.startup(false);
|
||||
CLogMgt.setLevel(Level.FINE);
|
||||
|
||||
String logLevel = System.getProperty("LogLevel");
|
||||
if (logLevel == null)
|
||||
logLevel = "INFO";
|
||||
switch (logLevel) {
|
||||
case "SEVERE": CLogMgt.setLevel(Level.SEVERE); break;
|
||||
case "WARNING": CLogMgt.setLevel(Level.WARNING); break;
|
||||
case "INFO": CLogMgt.setLevel(Level.INFO); break;
|
||||
case "CONFIG": CLogMgt.setLevel(Level.CONFIG); break;
|
||||
case "FINE": CLogMgt.setLevel(Level.FINE); break;
|
||||
case "FINER": CLogMgt.setLevel(Level.FINER); break;
|
||||
case "FINEST": CLogMgt.setLevel(Level.FINEST); break;
|
||||
default: CLogMgt.setLevel(Level.INFO); break;
|
||||
}
|
||||
Map<?, ?> args = context.getArguments();
|
||||
String commandlineArgs[] = (String[]) args.get("application.args");
|
||||
if (commandlineArgs.length == 1) {
|
||||
Properties ctx = Env.getCtx();
|
||||
Env.setContext(ctx, "org.adempiere.base.PackInFolderApplication", "Y");
|
||||
String directory = commandlineArgs[0];
|
||||
ProcessInfo pi = new ProcessInfo("PackInFolder", 200099);
|
||||
pi.setAD_Client_ID(0);
|
||||
|
|
|
@ -118,6 +118,7 @@ public class PackInApplicationActivator extends AbstractActivator {
|
|||
t.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (! "Y".equals(Env.getContext(Env.getCtx(), "org.adempiere.base.PackInFolderApplication"))) {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
try {
|
||||
Thread.currentThread().setContextClassLoader(PackInApplicationActivator.class.getClassLoader());
|
||||
|
@ -128,7 +129,8 @@ public class PackInApplicationActivator extends AbstractActivator {
|
|||
service = null;
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
}
|
||||
t.cancel();
|
||||
}
|
||||
t.cancel();
|
||||
}
|
||||
}, timeout);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue