[#BloombergLP-ball-AsyncFileObserver-enableFileLogging] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::xref:BloombergLP/ball/AsyncFileObserver.adoc[AsyncFileObserver]::enableFileLogging :relfileprefix: ../../../ :mrdocs: Enable logging of all records published to this async file observer to a file whose name is derived from the specified `logFilenamePattern`. Return 0 on success, a positive value if file logging is already enabled (with no effect), and a negative value otherwise. The basename of `logFilenamePattern` may contain `%`‐escape sequences that are interpreted as follows: ` %Y ‐ current year (4 digits with leading zeros) %M ‐ current month (2 digits with leading zeros) %D ‐ current day (2 digits with leading zeros) %h ‐ current hour (2 digits with leading zeros) %m ‐ current minute (2 digits with leading zeros) %s ‐ current second (2 digits with leading zeros) %T ‐ current datetime, equivalent to "%Y%M%D_%h%m%s" %p ‐ process ID ` Each time a log file is opened by this async file observer (upon a successful call to this method and following each log file rotation), the name of the new log file is derived from `logFilenamePattern` by interpreting the above recognized `%`‐escape sequences. If `isPublishInLocalTimeEnabled` returns `true`, the `%`‐escape sequences related to time will be substituted with local time values, and UTC time values otherwise. Note that, if a publication thread is running, it will now publish queued records to the log file where it previously was only publishing queued records to `stdout`. == Synopsis Declared in `<ball_asyncfileobserver.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int enableFileLogging(char const* logFilenamePattern); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#