[#BloombergLP-ball-FileObserver-enableFileLogging-03]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::xref:BloombergLP/ball/FileObserver.adoc[FileObserver]::enableFileLogging
:relfileprefix: ../../../
:mrdocs:

Enable file logging using a name derived from `logFilenamePattern`&period;

== Synopsis

Declared in `&lt;ball&lowbar;fileobserver&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
enableFileLogging(char const* logFilenamePattern);
----

== Description

Enable logging of all records published to this file observer to a file whose name is derived from the specified `logFilenamePattern`&period; Return 0 on success, a positive value if file logging is already enabled (with no effect), and a negative value otherwise&period; The basename of `logFilenamePattern` may contain `%`&hyphen;escape sequences that are interpreted as follows&colon; &grave; %Y &hyphen; current year (4 digits with leading zeros) %M &hyphen; current month (2 digits with leading zeros) %D &hyphen; current day (2 digits with leading zeros) %h &hyphen; current hour (2 digits with leading zeros) %m &hyphen; current minute (2 digits with leading zeros) %s &hyphen; current second (2 digits with leading zeros) %T &hyphen; current datetime, equivalent to &quot;%Y%M%D&lowbar;%h%m%s&quot; %p &hyphen; process ID &grave; 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 `%`&hyphen;escape sequences&period; If `isPublishInLocalTimeEnabled` returns `true`, the `%`&hyphen;escape sequences related to time will be substituted with local time values, and UTC time values otherwise&period; See &lcub;Log Filename Patterns&rcub;&period;

== Return Value

0 on success, positive if already enabled, negative on error

== Parameters

[cols="1,4"]
|===
| Name| Description
| *logFilenamePattern*
| filename pattern, possibly with `%`&hyphen;escapes
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
