Class PosixViewAttributeAction
- java.lang.Object
-
- org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
-
- org.apache.logging.log4j.core.appender.rolling.action.AbstractPathAction
-
- org.apache.logging.log4j.core.appender.rolling.action.PosixViewAttributeAction
-
- All Implemented Interfaces:
java.lang.Runnable
,Action
@Plugin(name="PosixViewAttribute", category="Core", printObject=true) public class PosixViewAttributeAction extends AbstractPathAction
File POSIX attribute view action. Allow to define file permissions, user and group for log files on POSIX supported OS.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PosixViewAttributeAction.Builder
Builder for the POSIX view attribute action.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
fileGroup
File group.private java.lang.String
fileOwner
File owner.private java.util.Set<java.nio.file.attribute.PosixFilePermission>
filePermissions
File permissions.-
Fields inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
LOGGER
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PosixViewAttributeAction(java.lang.String basePath, boolean followSymbolicLinks, int maxDepth, PathCondition[] pathConditions, StrSubstitutor subst, java.util.Set<java.nio.file.attribute.PosixFilePermission> filePermissions, java.lang.String fileOwner, java.lang.String fileGroup)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.nio.file.FileVisitor<java.nio.file.Path>
createFileVisitor(java.nio.file.Path basePath, java.util.List<PathCondition> conditions)
Creates a newFileVisitor<Path>
to pass to theFiles.walkFileTree(Path, Set, int, FileVisitor)
method when theAbstractPathAction.execute()
method is invoked.java.lang.String
getFileGroup()
Returns file group if defined and the OS supports POSIX/group file attribute view, null otherwise.java.lang.String
getFileOwner()
Returns file owner if defined and the OS supports owner file attribute view, null otherwise.java.util.Set<java.nio.file.attribute.PosixFilePermission>
getFilePermissions()
Returns POSIX file permissions if defined and the OS supports POSIX file attribute, null otherwise.static PosixViewAttributeAction.Builder
newBuilder()
java.lang.String
toString()
-
Methods inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractPathAction
execute, execute, getBasePath, getBasePathString, getMaxDepth, getOptions, getPathConditions, getStrSubstitutor, isFollowSymbolicLinks
-
Methods inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
close, isComplete, isInterrupted, reportException, run
-
-
-
-
Constructor Detail
-
PosixViewAttributeAction
private PosixViewAttributeAction(java.lang.String basePath, boolean followSymbolicLinks, int maxDepth, PathCondition[] pathConditions, StrSubstitutor subst, java.util.Set<java.nio.file.attribute.PosixFilePermission> filePermissions, java.lang.String fileOwner, java.lang.String fileGroup)
-
-
Method Detail
-
newBuilder
@PluginBuilderFactory public static PosixViewAttributeAction.Builder newBuilder()
-
createFileVisitor
protected java.nio.file.FileVisitor<java.nio.file.Path> createFileVisitor(java.nio.file.Path basePath, java.util.List<PathCondition> conditions)
Description copied from class:AbstractPathAction
Creates a newFileVisitor<Path>
to pass to theFiles.walkFileTree(Path, Set, int, FileVisitor)
method when theAbstractPathAction.execute()
method is invoked.The visitor is responsible for processing the files it encounters that are accepted by all filters.
- Specified by:
createFileVisitor
in classAbstractPathAction
- Parameters:
basePath
- base dir from where to start scanning for files to processconditions
- filters that determine if a file should be processed- Returns:
- a new
FileVisitor<Path>
-
getFilePermissions
public java.util.Set<java.nio.file.attribute.PosixFilePermission> getFilePermissions()
Returns POSIX file permissions if defined and the OS supports POSIX file attribute, null otherwise.- Returns:
- File POSIX permissions
- See Also:
PosixFileAttributeView
-
getFileOwner
public java.lang.String getFileOwner()
Returns file owner if defined and the OS supports owner file attribute view, null otherwise.- Returns:
- File owner
- See Also:
FileOwnerAttributeView
-
getFileGroup
public java.lang.String getFileGroup()
Returns file group if defined and the OS supports POSIX/group file attribute view, null otherwise.- Returns:
- File group
- See Also:
PosixFileAttributeView
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractPathAction
-
-