---
name: "log4c_rollingfile_udata_get_logdir"
section: "3"
platform: "linux"
package: "liblog4c-doc"
version: "1.2.4-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/log4c_appender_type_rollingfile.h"
---

# log4c\_rollingfile\_udata\_get\_logdir(3)

Log4c rolling file appender interface.

Part of [log4c\_appender\_type\_rollingfile.h(3)](/log4c_appender_type_rollingfile.h/3.md).

## NAME

appender\_type\_rollingfile.h - Log4c rolling file appender interface.

## SYNOPSIS

`#include <log4c/defs.h>`\
 `#include <log4c/appender.h>`\
 `#include <log4c/rollingpolicy.h>`\

### Functions

rollingfile\_udata\_t \* **rollingfile\_make\_udata** (void)\
 int **rollingfile\_udata\_set\_logdir** (rollingfile\_udata\_t \*rfudatap, const char \*logdir)\
 int **rollingfile\_udata\_set\_files\_prefix** (rollingfile\_udata\_t \*rfudatap, const char \*prefix)\
 int **rollingfile\_udata\_set\_policy** (rollingfile\_udata\_t \*rfudatap, **log4c\_rollingpolicy\_t** \*policyp)\
 const char \* **rollingfile\_udata\_get\_logdir** (rollingfile\_udata\_t \*rfudatap)\
 const char \* **rollingfile\_udata\_get\_files\_prefix** (rollingfile\_udata\_t \*rfudatap)\
 long **rollingfile\_get\_current\_file\_size** (rollingfile\_udata\_t \*rfudatap)\

### Variables

\_\_LOG4C\_BEGIN\_DECLS const **log4c\_appender\_type\_t** **log4c\_appender\_type\_rollingfile**\

## Detailed Description

Log4c rolling file appender interface.

The rolling file appender implements a logging mechanism of a list of files up to a maximum number.

The files are written by default to the current directory with logging names folowing the pattern log.1, log.2 etc. These parameters may be changed using the appropriate setter functions.

If the appender fails to open logfiles for writing then the messages are logged to stderr--it will continue to try to open the zero-th file for writing at rollover events so if it succeeds at some point to open that file the messages will start to appear therein and will no longer be sent to stderr.

Switching from logging from one file to the next is referred to as a 'rollover event'.

The policy that determines when a rollover event should happen is called a 'rolling policy'.

A mechanism is provided to allow different rolling policies to be defined.

Log4c ships with (and defaults to) the classic size-window rollover policy: this triggers rollover when files reach a maximum size. The first file in the list is always the current file; when a rollover event occurs files are shifted up by one position in the list--if the number of files in the list has already reached the max then the oldest file is rotated out of the window.

See the documentation in the **rollingpolicy\_type\_sizewin.h** file for more details on the size-win rollover policy.

## Function Documentation

### long rollingfile\_get\_current\_file\_size (rollingfile\_udata\_t \* rfudatap)

Get the prefix string in this rolling file appender configuration.

**Parameters**

*rfudatap* the rolling file appender configuration object.

**Returns**

the current size of the file being logged to.

### rollingfile\_udata\_t \* rollingfile\_make\_udata (void)

Get a new rolling file appender configuration object.

**Returns**

a new rolling file appender configuration object, otherwise NULL.

### const char \* rollingfile\_udata\_get\_files\_prefix (rollingfile\_udata\_t \* rfudatap)

Get the prefix string in this rolling file appender configuration.

**Parameters**

*rfudatap* the rolling file appender configuration object.

**Returns**

the prefix.

### const char \* rollingfile\_udata\_get\_logdir (rollingfile\_udata\_t \* rfudatap)

Get the logging directory in this rolling file appender configuration.

**Parameters**

*rfudatap* the rolling file appender configuration object.

**Returns**

the logging directory.

### int rollingfile\_udata\_set\_files\_prefix (rollingfile\_udata\_t \* rfudatap, const char \* prefix)

Set the prefix string in this rolling file appender configuration.

**Parameters**

*rfudatap* the rolling file appender configuration object. \
 *prefix* the logging files prfix to use.

**Returns**

zero if successful, non-zero otherwise.

### int rollingfile\_udata\_set\_logdir (rollingfile\_udata\_t \* rfudatap, const char \* logdir)

Set the logging directory in this rolling file appender configuration.

**Parameters**

*rfudatap* the rolling file appender configuration object. \
 *logdir* the logging directory to set.

**Returns**

zero if successful, non-zero otherwise.

### int rollingfile\_udata\_set\_policy (rollingfile\_udata\_t \* rfudatap, log4c\_rollingpolicy\_t \* policyp)

Set the rolling policy in this rolling file appender configuration.

**Parameters**

*rfudatap* the rolling file appender configuration object. \
 *policyp* the logging files prfix to use.

**Returns**

zero if successful, non-zero otherwise.

## Variable Documentation

### \_\_LOG4C\_BEGIN\_DECLS const log4c\_appender\_type\_t log4c\_appender\_type\_rollingfile

rollingfile appender type definition.

This should be used as a parameter to the log4c\_appender\_set\_type() routine to set the type of the appender.

## Author

Generated automatically by Doxygen for log4c from the source code.
