Martin Peřina has posted comments on this change. Change subject: tools: Adds helpers to configure java logging in tools ......................................................................
Patch Set 7: (3 comments) http://gerrit.ovirt.org/#/c/32852/7/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/log/JavaLoggingUtils.java File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/log/JavaLoggingUtils.java: Line 39: */ Line 40: public static void addFileHandler(String fileName) { Line 41: try { Line 42: FileHandler fh = new FileHandler(fileName); Line 43: fh.setFormatter(new SimpleFormatter()); > I think that the formatter can be gotten out of the logging properties so y XMLFormatter is default for FileHandler, so we need to change it to SimpleFormatter Line 44: getOvirtLogger().addHandler(fh); Line 45: } catch (SecurityException | IOException ex) { Line 46: throw new IllegalArgumentException( Line 47: String.format("Error accessing log file '%s': '%s'", fileName, ex.getMessage()), Line 40: public static void addFileHandler(String fileName) { Line 41: try { Line 42: FileHandler fh = new FileHandler(fileName); Line 43: fh.setFormatter(new SimpleFormatter()); Line 44: getOvirtLogger().addHandler(fh); > don't you need to set the level of the formatter(?) to FINEST? No, by default it's ALL Line 45: } catch (SecurityException | IOException ex) { Line 46: throw new IllegalArgumentException( Line 47: String.format("Error accessing log file '%s': '%s'", fileName, ex.getMessage()), Line 48: ex); Line 63: * Returns instance of ovirt logger (it creates new instance if current one is {@code null}). Line 64: */ Line 65: private static Logger getOvirtLogger() { Line 66: if (ovirtLogger == null) { Line 67: ovirtLogger = Logger.getLogger("org.ovirt"); > I am sorry I still do not understand why we cannot get this at static conte We don't need to hold the instance, if we don't set configuration for it. It would be just meaningless step for logging framework to find handler and level for log message. But if you insist I will move it to static context Line 68: } Line 69: return ovirtLogger; Line 70: } -- To view, visit http://gerrit.ovirt.org/32852 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie1c46ca552888b347a4ff810003e0fcc818f832f Gerrit-PatchSet: 7 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Peřina <mper...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Martin Peřina <mper...@redhat.com> Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches