Package com.sun.common.util.logging
Class LoggingConfigImpl
- java.lang.Object
-
- com.sun.common.util.logging.LoggingConfigImpl
-
- All Implemented Interfaces:
LoggingConfig
@Service @Contract public class LoggingConfigImpl extends Object implements LoggingConfig
Implementation of Logging Commands- Author:
- Naman Mehta
-
-
Field Summary
Fields Modifier and Type Field Description protected static Map<String,String>
DEFAULT_LOG_PROPERTIES
-
Constructor Summary
Constructors Constructor Description LoggingConfigImpl(File defaultConfigDir, File configDir)
LoggingConfigImpl(ServerEnvironmentImpl env)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
checkForLoggingProperties(Map<String,String> loggingProperties)
String
createZipFile(String sourceDir)
Creates a ZIP file from a given directory.String
createZipFile(String sourceDir, String zipFileName)
Map<String,String>
deleteLoggingProperties(Map<String,String> properties)
Deletes all properties from the provided list.String
getLoggingFileDetails()
Map<String,String>
getLoggingProperties()
Get all properties from the managed file.Map<String,String>
getLoggingProperties(boolean usePlaceholderReplacement)
Get all properties from the managed file.String
getLoggingProperty(String propertyName)
Gets a given property from the managed file.void
initialize(String target)
Initializes the configuration for a given target.Map<String,String>
setLoggingProperties(Map<String,String> properties)
Sets all properties within the managed file.String
setLoggingProperty(String propertyName, String propertyValue)
Sets the given property within the managed file.
-
-
-
Constructor Detail
-
LoggingConfigImpl
@Inject public LoggingConfigImpl(ServerEnvironmentImpl env)
-
-
Method Detail
-
initialize
public void initialize(String target) throws IOException
Description copied from interface:LoggingConfig
Initializes the configuration for a given target.- Specified by:
initialize
in interfaceLoggingConfig
- Parameters:
target
- the target to fetch the logs from.- Throws:
IOException
- if an error occurred while reading from the managed file.
-
setLoggingProperty
public String setLoggingProperty(String propertyName, String propertyValue) throws IOException
Description copied from interface:LoggingConfig
Sets the given property within the managed file.- Specified by:
setLoggingProperty
in interfaceLoggingConfig
- Parameters:
propertyName
- the name of the property to set.propertyValue
- the value of the property to set.- Returns:
- the property value in the file.
- Throws:
IOException
- if an error occurred while writing to the managed file.
-
setLoggingProperties
public Map<String,String> setLoggingProperties(Map<String,String> properties) throws IOException
Description copied from interface:LoggingConfig
Sets all properties within the managed file.- Specified by:
setLoggingProperties
in interfaceLoggingConfig
- Returns:
- all properties to set within the managed file.
- Throws:
IOException
- if an error occurred while writing to the managed file.
-
getLoggingProperty
public String getLoggingProperty(String propertyName) throws IOException
Description copied from interface:LoggingConfig
Gets a given property from the managed file.- Specified by:
getLoggingProperty
in interfaceLoggingConfig
- Parameters:
propertyName
- the name of the property to get.- Returns:
- the value of the property, or null if it doesn't exist.
- Throws:
IOException
- if an error occurred while reading from the managed file.
-
getLoggingProperties
public Map<String,String> getLoggingProperties() throws IOException
Description copied from interface:LoggingConfig
Get all properties from the managed file.- Specified by:
getLoggingProperties
in interfaceLoggingConfig
- Returns:
- all properties contained within the managed file.
- Throws:
IOException
- if an error occurred while reading from the managed file.
-
getLoggingProperties
public Map<String,String> getLoggingProperties(boolean usePlaceholderReplacement) throws IOException
Description copied from interface:LoggingConfig
Get all properties from the managed file.- Specified by:
getLoggingProperties
in interfaceLoggingConfig
- Parameters:
usePlaceholderReplacement
- - true for placeholder replacement, false returns original property value- Returns:
- a Map of all the properties and corresponding values in the logging.properties file.
- Throws:
IOException
-
checkForLoggingProperties
public Map<String,String> checkForLoggingProperties(Map<String,String> loggingProperties) throws IOException
- Throws:
IOException
-
deleteLoggingProperties
public Map<String,String> deleteLoggingProperties(Map<String,String> properties) throws IOException
Description copied from interface:LoggingConfig
Deletes all properties from the provided list.- Specified by:
deleteLoggingProperties
in interfaceLoggingConfig
- Parameters:
properties
- all properties to delete within the managed file.- Returns:
- the list of deleted properties.
- Throws:
IOException
- if an error occurred while writing to the managed file.
-
createZipFile
public String createZipFile(String sourceDir) throws IOException
Description copied from interface:LoggingConfig
Creates a ZIP file from a given directory.- Specified by:
createZipFile
in interfaceLoggingConfig
- Parameters:
sourceDir
- the directory to ZIP.- Throws:
IOException
- if an error occurred while creating the ZIP.
-
createZipFile
public String createZipFile(String sourceDir, String zipFileName) throws IOException
- Throws:
IOException
-
getLoggingFileDetails
public String getLoggingFileDetails() throws IOException
- Specified by:
getLoggingFileDetails
in interfaceLoggingConfig
- Returns:
- the file for the GFHandler to log to.
- Throws:
IOException
- if an error occurred while reading from the managed file.
-
-