Add LanguageWorkerConsoleLog Key (#157)
This commit is contained in:
Родитель
af26265a3b
Коммит
49dbe7ce9e
|
@ -117,7 +117,7 @@ public final class Application implements IApplication {
|
|||
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Microsoft Azure Functions Java Runtime [build " + version() + "]");
|
||||
WorkerLogManager.getSystemLogger().log(Level.INFO, "Azure Functions Java Worker version [ " + version() + "]");
|
||||
Application app = new Application(args);
|
||||
if (!app.isCommandlineValid()) {
|
||||
app.printUsage();
|
||||
|
|
|
@ -74,14 +74,16 @@ public class WorkerLogManager {
|
|||
class SystemLoggerListener extends Handler {
|
||||
@Override
|
||||
public void publish(LogRecord record) {
|
||||
String LanguageWorkerConsoleLogKey = "LanguageWorkerConsoleLog";
|
||||
if (record != null && record.getLevel() != null) {
|
||||
PrintStream output = (record.getLevel().intValue() <= Level.INFO.intValue() ? System.out : System.err);
|
||||
output.println(String.format("[%s] {%s.%s}: %s",
|
||||
output.println(String.format("%s[%s] {%s.%s}: %s",
|
||||
LanguageWorkerConsoleLogKey,
|
||||
record.getLevel(),
|
||||
ClassUtils.getShortClassName(record.getSourceClassName()), record.getSourceMethodName(),
|
||||
record.getMessage()));
|
||||
if (record.getThrown() != null) {
|
||||
output.println(String.format("%s", ExceptionUtils.getStackTrace(record.getThrown())));
|
||||
output.println(String.format("%s%s", LanguageWorkerConsoleLogKey, ExceptionUtils.getStackTrace(record.getThrown())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче