[ 
https://issues.apache.org/jira/browse/DERBY-6359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13783210#comment-13783210
 ] 

Brett Bergquist commented on DERBY-6359:
----------------------------------------

Here is what I have for the documentation Kim.

The rolling file implementation can either write to a specified file, or it can 
write to a rotating set of files.

For a rotating set of files, as each file reaches a given size limit, it is 
closed, rotated out, and a new file opened. Successively older files are named 
by adding "0", "1", "2", etc into the base filename.

The rolling file implementation is specified by adding:

        derby.stream.error.style=rollingFile

in the "derby.properties" file.   This property overrides:

        derby.stream.error.file
        derby.stream.error.method
        derby.stream.error.field

With no other options specified, the rolling file implementation will create up 
to 10 rolling files "derby-0.log, derby-1.log, … derby-9.log" with each file 
having a limit of 1024000 bytes. 

The rolling file implementation can be configured with the following optional 
properties:

        derby.stream.error.rollingFile.limit=<bytes>

which specifies the number of bytes to limit each rolling file to before 
rolling to the next file.  The default value is "1024000"

        derby.stream.error.rollingFile.count=<file count>

which specifies the number of rolling files to permit before deleting the 
oldest file when rolling to the next file.  The default value is "10"

        derby.stream.error.rollingFile.pattern=<pattern>

A pattern consists of a string that includes the following special components 
that will be replaced at runtime.  The default value is "%d/derby-%g.log"
        •       "/" the local pathname separator
        •       "%t" the system temporary directory
        •       "%h" the value of the "user.home" system property
        •       "%d" the value of the "derby.system.home" system property
        •       "%g" the generation number to distinguish rotated logs
        •       "%u" a unique number to resolve conflicts
        •       "%%" translates to a single percent sign "%"

If no "%g" field has been specified and the file count is greater than one, 
then the generation number will be added to the end of the generated filename, 
after a dot.
Thus for example a pattern of "%t/java%g.log" with a count of 2 would typically 
cause log files to be written on Solaris to /var/tmp/java0.log and 
/var/tmp/java1.log whereas on Windows 95 they would be typically written to 
C:\TEMP\java0.log and C:\TEMP\java1.log
Generation numbers follow the sequence 0, 1, 2, etc.

Normally the "%u" unique field is set to 0. However, if the FileHandler tries 
to open the filename and finds the file is currently in use by another process 
it will increment the unique number field and try again. This will be repeated 
until FileHandler finds a file name that is not currently in use. If there is a 
conflict and no "%u" field has been specified, it will be added at the end of 
the filename after a dot. (This will be after any automatically added 
generation number.)
Thus if three processes were all trying to log to fred%u.%g.txt then they might 
end up using fred0.0.txt, fred1.0.txt, fred2.0.txt as the first file in their 
rotating sequences.

Note that the use of unique ids to avoid conflicts is only guaranteed to work 
reliably when using a local disk file system.

The property "derby.infolog.append" is also supported.  When set to 

        derby.infolog.append=true

an existing log file, if any, will be appended to.  When set to 

        derby.infolog.append=false

the existing log files, if any, will be rolled and a new log file will be 
created.


> Document rolling derby.log file feature
> ---------------------------------------
>
>                 Key: DERBY-6359
>                 URL: https://issues.apache.org/jira/browse/DERBY-6359
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>            Reporter: Brett Bergquist
>            Assignee: Kim Haase
>            Priority: Minor
>              Labels: documentation
>
> The rolling derby.log file feature needs to be documented.  This will be used 
> to provide the information necessary to do so.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to