Revision as of 13:15, 20 June 2014 by Bdschubert (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)


Friday, June 20, 2014 5:34 AM

How do I Add a Timestamp to the Logs?

This FAQ entry demonstrates how to prepend a timestamp to your log file entries. For example:

05:42:51.210 CONFIG [com.emxsys.wmt.core.project.GlobalActionContextProxy]: Creating a proxy for Utilities.actionsGlobalContext()
05:42:51.295 WARNING [org.openide.filesystems.Ordering]: Not all children in Services/MIMEResolver/ marked with the position attribute: ....
05:42:52.151 INFO [org.netbeans.core.startup.NbEvents]: Turning on modules:
05:43:08.030 INFO [com.terramenta.globe.WorldWindManager]: Session has been restored.
05:43:12.823 INFO [org.netbeans.core.ui.warmup.DiagnosticTask]: Total memory 4,168,376,320
05:43:08.040 CONFIG [com.emxsys.wmt.core.project.MainWindowTitleManager]: Initializing global context lookup listener for Projects

Please note, the NetBeans Platform includes its own logging mechanism. If you customize the logging through the use of the java.util.logging.config.file or java.util.logging.config.class property settings, then the native NetBeans logging mechanism is disabled, and either the default Java logging or your custom logging class is used instead.

This solution shows how to customize the output from the native NetBeans log formatter, NbFormatter, by creating a new custom formatter that by prepends a timestamp to the NbFormatter output. Note, using NbFormatter requires a private package reference to the org-netbeans-core-startup module. This will FAQ show how to establish private package access.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo