[#BloombergLP-ball-FileObserver2-enableFileLogging-0b] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::xref:BloombergLP/ball/FileObserver2.adoc[FileObserver2]::enableFileLogging :relfileprefix: ../../../ :mrdocs: `enableFileLogging` overloads == Synopses Declared in `<ball_fileobserver2.h>` 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}. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int xref:BloombergLP/ball/FileObserver2/enableFileLogging-0f2.adoc[enableFileLogging](char const* logFilenamePattern); ---- [.small]#xref:BloombergLP/ball/FileObserver2/enableFileLogging-0f2.adoc[_» more..._]# Enable logging of all records published to this file observer to a file whose name is derived from the specified `logFilenamePattern` and append a timestamp to the log filename if the specified `appendTimestampFlag` is `true`. Return 0 on success, a positive value if file logging is already enabled (with no effect), and a negative value otherwise. If the `appendTimestampFlag` is `true` and `logFilenamePattern` does not contain any `%`‐escape sequences, this method behaves as if ".%T" is appended to `logFilenamePattern`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int xref:BloombergLP/ball/FileObserver2/enableFileLogging-0f6.adoc[enableFileLogging]( char const* logFilenamePattern, bool appendTimestampFlag); ---- [.small]#xref:BloombergLP/ball/FileObserver2/enableFileLogging-0f6.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#