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)StringcreateZipFile(String sourceDir)Creates a ZIP file from a given directory.StringcreateZipFile(String sourceDir, String zipFileName)Map<String,String>deleteLoggingProperties(Map<String,String> properties)Deletes all properties from the provided list.StringgetLoggingFileDetails()Map<String,String>getLoggingProperties()Get all properties from the managed file.Map<String,String>getLoggingProperties(boolean usePlaceholderReplacement)Get all properties from the managed file.StringgetLoggingProperty(String propertyName)Gets a given property from the managed file.voidinitialize(String target)Initializes the configuration for a given target.Map<String,String>setLoggingProperties(Map<String,String> properties)Sets all properties within the managed file.StringsetLoggingProperty(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:LoggingConfigInitializes the configuration for a given target.- Specified by:
initializein 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:LoggingConfigSets the given property within the managed file.- Specified by:
setLoggingPropertyin 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:LoggingConfigSets all properties within the managed file.- Specified by:
setLoggingPropertiesin 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:LoggingConfigGets a given property from the managed file.- Specified by:
getLoggingPropertyin 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:LoggingConfigGet all properties from the managed file.- Specified by:
getLoggingPropertiesin 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:LoggingConfigGet all properties from the managed file.- Specified by:
getLoggingPropertiesin 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:LoggingConfigDeletes all properties from the provided list.- Specified by:
deleteLoggingPropertiesin 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:LoggingConfigCreates a ZIP file from a given directory.- Specified by:
createZipFilein 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:
getLoggingFileDetailsin interfaceLoggingConfig- Returns:
- the file for the GFHandler to log to.
- Throws:
IOException- if an error occurred while reading from the managed file.
-
-