IDEMPIERE-5608: Improve server logs by tenant and user data (#1715)

* IDEMPIERE-5608: Improve server logs by tenant and user data

* IDEMPIERE-5608: Improve server logs by tenant and user data - migration script

* IDEMPIERE-5680: Improve server logs by tenant and user data - use VM argument

Co-Authored-By: Carlos Ruiz <carg67@gmail.com>

* IDEMPIERE-5608: Improve server logs by tenant and user data: various fixes

* IDEMPIERE-5608: Improve server logs by tenant and user data - revert changes on server.product.launch

* IDEMPIERE-5608: Improve server logs by tenant and user data - Carlos's patch

tested: )
Co-Authored-By: Carlos Ruiz <carg67@gmail.com>

---------

Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
Nicolas Micoud 2023-03-21 05:08:44 +01:00 committed by GitHub
parent 7a9ce71835
commit 85af1ed2a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 1 deletions

View File

@ -119,6 +119,7 @@ public class CLogFormatter extends Formatter
spaces = 9; spaces = 9;
sb.append(" ".substring(0, spaces)); sb.append(" ".substring(0, spaces));
} }
sb.append(getPrefix());
/** Class.method **/ /** Class.method **/
if (!m_shortFormat) if (!m_shortFormat)
@ -319,4 +320,25 @@ public class CLogFormatter extends Formatter
fillExceptionTrace(sb, "caused by: ", cause); fillExceptionTrace(sb, "caused by: ", cause);
} // fillExceptionTrace } // fillExceptionTrace
/**
* get the Prefix to write in file log from VM variable org.idempiere.FileLogPrefix
* @return
*/
private String getPrefix()
{
String prefix = null;
try
{
prefix = System.getProperty("org.idempiere.FileLogPrefix");
if (!Util.isEmpty(prefix))
return Env.parseContext(Env.getCtx(), 0, prefix, false);
}
catch (Exception ex)
{
System.out.println("Parsing error in org.idempiere.FileLogPrefix - setting back to empty from " + prefix);
System.setProperty("org.idempiere.FileLogPrefix", "");
}
return "";
}
} // CLogFormatter } // CLogFormatter