AppenderFile
- LoggerAppender
AppenderFile extends LoggerAppender
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SubTypes
Property summary
Modifier and Type | Property |
---|---|
protected boolean | locking |
protected boolean | append |
protected string | file |
protected resource | fp |
Methods summary
Modifier and Type | Method |
---|---|
protected | getTargetFile ( ) |
protected boolean | openFile ( ) |
protected | write ( string string ) |
protected | writeWithLocking ( unknown string ) |
protected | writeWithoutLocking ( unknown string ) |
public | activateOptions ( ) |
public | close ( ) |
public | append ( LoggingEvent event ) |
public | setFile ( string file ) |
public string | getFile ( ) |
public boolean | getAppend ( ) |
public | setAppend ( boolean append ) |
public | setFileName ( string fileName ) |
public string | getFileName ( ) |
Properties in detail
-
locking
protected boolean locking
If set to true, the file is locked before appending. This allows concurrent access. However, appending without locking is faster so it should be used where appropriate. TODO: make this a configurable parametervar
boolean -
append
protected boolean append
If set to true, appends to file. Otherwise overwrites it.var
boolean -
file
protected string file
Path to the target file.var
string -
fp
protected resource fp
The file resource.var
resource
Methods in detail
-
getTargetFile
protected getTargetFile ( )Helper function which can be easily overriden by daily file appender. -
openFile
boolean protected openFile ( )Acquires the target file resource, creates the destination folder if necessary. Writes layout header to file.return
boolean -
write
protected write ( string string )Writes a string to the target file. Opens file if not already open.param
string string Data to write. -
writeWithLocking
protected writeWithLocking ( unknown string ) -
writeWithoutLocking
protected writeWithoutLocking ( unknown string ) -
activateOptions
public activateOptions ( ) -
close
public close ( ) -
append
public append ( LoggingEvent event ) -
setFile
public setFile ( string file )Sets the 'file' parameter.param
string file -
getFile
string public getFile ( )Returns the 'file' parameter.return
string -
getAppend
boolean public getAppend ( )Returns the 'append' parameter.return
boolean -
setAppend
public setAppend ( boolean append )Sets the 'append' parameter.param
boolean append -
setFileName
public setFileName ( string fileName )Sets the 'file' parmeter. Left for legacy reasons.param
string fileNamedeprecated
deprecated -
getFileName
string public getFileName ( )Returns the 'file' parmeter. Left for legacy reasons.return
stringdeprecated
deprecated