[#BloombergLP-ball-FileObserver-enableFileLogging-03] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::xref:BloombergLP/ball/FileObserver.adoc[FileObserver]::enableFileLogging :relfileprefix: ../../../ :mrdocs: Enable logging of all records published to this 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 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. See {Log Filename Patterns}. == Synopsis Declared in `<ball_fileobserver.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int enableFileLogging(char const* logFilenamePattern); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#