# derby.stream.error.rollingFile.pattern

The derby.stream.error.rollingFile.pattern property specifies the naming pattern to use for the rolling log files, if derby.stream.error.style is set to `rollingFile`.

If derby.stream.error.style is not set, this property setting is ignored.

You can override other rolling log file defaults by setting derby.stream.error.rollingFile.count or derby.stream.error.rollingFile.limit.

A pattern consists of a string that includes the following special components that will be replaced at runtime.

Table 1. Rolling log file pattern components
Pattern component | Description
--- | ---
`/` | Local path name 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 log files. Generation numbers follow the sequence 0, 1, 2, and so on. If you do not specify a `%g` field and the file count is greater than one, the generation number will be added to the end of the generated filename, after a dot.
`%u` | A unique number to resolve conflicts.
`%%` | Translates to a single percent sign (`%`)

Thus, for example, a derby.stream.error.rollingFile.pattern setting of `%t/java%g.log` with a derby.stream.error.rollingFile.count setting of 2 might cause log files on a UNIX system to be written to /var/tmp/java0.log and /var/tmp/java1.log, whereas on a Windows 7 system they might be written to %USERPROFILE%\AppData\Local\Temp\java0.log and %USERPROFILE%\AppData\Local\Temp\java1.log.

Normally, the `%u` unique field is set to 0 (zero). However, if Derby tries to open the file by the specified name and finds that the file is currently in use by another process, it will increment the unique number field and try again. This action will be repeated until Derby finds a file name that is not currently in use. If there is a conflict and no `%u` field has been specified, the unique number will be added at the end of the filename after a dot. (This will be after any automatically added generation number.)

For example, if three processes are all trying to log to `fred%u.%g.txt`, they might have log files named fred0.0.txt, fred1.0.txt, fred2.0.txt as the first file in their rotating sequences.

Note: The use of unique fields to avoid conflicts is guaranteed to work reliably only when you are using a local disk file system.

## Syntax

    derby.stream.error.rollingFile.pattern=pattern

The number of characters in the specified pattern value must be equal to or greater than 1.

## Default

`%d/derby-%g.log`.

## Example

The following setting creates files named myDBlog-0.txt, myDBlog-1.txt, and so on, in the user's home directory:

    derby.stream.error.rollingFile.pattern=%h/myDBlog-%g.txt

## Scope

system-wide

## Dynamic or static

This property is static; if you change it while Derby is running, the change does not take effect until you reboot.

Parent topic: Derby properties
Related reference
derby.authentication.builtin.algorithm
derby.authentication.builtin.iterations
derby.authentication.builtin.saltLength
derby.authentication.ldap.searchAuthDN
derby.authentication.ldap.searchAuthPW
derby.authentication.ldap.searchBase
derby.authentication.ldap.searchFilter
derby.authentication.native.passwordLifetimeMillis
derby.authentication.native.passwordLifetimeThreshold
derby.authentication.provider
derby.authentication.server
derby.connection.requireAuthentication
derby.database.classpath
derby.database.defaultConnectionMode
derby.database.forceDatabaseLock
derby.database.fullAccessUsers
derby.database.noAutoBoot
derby.database.propertiesOnly
derby.database.readOnlyAccessUsers
derby.database.sqlAuthorization
derby.infolog.append
derby.jdbc.xaTransactionTimeout
derby.language.logQueryPlan
derby.language.logStatementText
derby.language.sequence.preallocator
derby.language.statementCacheSize
derby.locks.deadlockTimeout
derby.locks.deadlockTrace
derby.locks.escalationThreshold
derby.locks.monitor
derby.locks.waitTimeout
derby.replication.logBufferSize
derby.replication.maxLogShippingInterval
derby.replication.minLogShippingInterval
derby.replication.verbose
derby.storage.indexStats.auto
derby.storage.indexStats.log
derby.storage.indexStats.trace
derby.storage.initialPages
derby.storage.minimumRecordSize
derby.storage.pageCacheSize
derby.storage.pageReservedSpace
derby.storage.pageSize
derby.storage.rowLocking
derby.storage.tempDirectory
derby.storage.useDefaultFilePermissions
derby.stream.error.extendedDiagSeverityLevel
derby.stream.error.field
derby.stream.error.file
derby.stream.error.logBootTrace
derby.stream.error.logSeverityLevel
derby.stream.error.method
derby.stream.error.rollingFile.count
derby.stream.error.rollingFile.limit
derby.stream.error.style
derby.system.bootAll
derby.system.durability
derby.system.home
derby.user.UserName
DataDictionaryVersion