DebugImpl.java revision c1b45299506613a522e8eeaffe0efd1b9cd5e355
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: DebugImpl.java,v 1.4 2009/03/07 08:01:53 veiming Exp $
*
*/
/**
* Portions Copyrighted 2014-2015 ForgeRock AS.
*/
/**
* Debug implementation class.
*/
private static Properties debugFileNames;
static {
}
private static volatile long lastDirectoryIssue = 0l;
private boolean mergeAllMode = false;
private DebugFileProvider debugFileProvider;
private DebugFile stdoutDebugFile;
/**
* Creates an instance of <code>DebugImpl</code>.
*
* @param debugName Name of the debug.
* @param debugFileProvider A debug file provider
*/
} else {
}
this.debugFileProvider = debugFileProvider;
//NB : we don't initialize debugFile now, we will do it when we will write on it
}
/**
* Returns debug name.
*
* @return debug name.
*/
return this.debugName;
}
/**
* Returns debug level.
*
* @return debug level.
*/
public int getState() {
return this.debugLevel.getLevel();
}
/**
* Sets debug level.
*
* @param level Debug level.
*/
try {
} catch (IllegalArgumentException e) {
// ignore invalid level values
}
}
/**
* Sets debug level.
*
* @param strDebugLevel Debug level.
*/
try {
} catch (IllegalArgumentException e) {
// ignore invalid level values
}
}
/**
* Sets debug level.
*
* @param debugLevel Debug level.
*/
this.debugLevel = debugLevel;
}
/**
* Reset this instance - ths will trigger this instance to reinitialize
* itself.
*
* @param mf merge flag : true: merge debugs into a single file.`
*/
// Note : we don't need to close the writer we will keep it
// in the Writer cache in case merge mode changes again.
}
/**
* Returns <code>true</code> if debug is enabled.
*
* @return <code>true</code> if debug is enabled.
*/
public boolean messageEnabled() {
}
/**
* Returns <code>true</code> if debug warning is enabled.
*
* @return <code>true</code> if debug warning is enabled.
*/
public boolean warningEnabled() {
}
/**
* Returns <code>true</code> if debug error is enabled.
*
* @return <code>true</code> if debug error is enabled.
*/
public boolean errorEnabled() {
}
/**
* Writes debug message.
*
* @param message Debug message.
* @param th Throwable object along with the message.
*/
if (messageEnabled()) {
}
}
/**
* Writes debug warning message.
*
* @param message Debug message.
* @param th Throwable object along with the warning message.
*/
if (warningEnabled()) {
}
}
/**
* Writes debug error message.
*
* @param message Debug message.
* @param th Throwable object along with the error message.
*/
if (errorEnabled()) {
}
}
prefix.append(debugName).append(":").append(this.dateFormat.format(new Date())).append(": ").append(Thread
.currentThread().toString());
}
/**
* Write message on Debug file. If it failed, it try to print it on the Sdtout Debug file.
* If both failed, it prints in System.out
*
* @param prefix Message prefix
* @param msg Message to be recorded.
* @param th the optional <code>java.lang.Throwable</code> which if
* present will be used to record the stack trace.
*/
//we create the debug file only if we need to write on it
}
try {
} else {
try {
} catch (IOException e) {
/*
* In order to have less logs for this kind of issue. It's waiting an interval of time before
* printing this error again.
*/
}
}
}
} catch (IOException ioex) {
}
}
/**
* Return the Debug file name that should be used for this debug name
*
* @return the debug file name to use
*/
private String resolveDebugFileName() {
if (mergeAllMode) {
} else {
// Find the bucket this debug belongs to
return nm;
} else {
// Default to debugName if no mapping is found
return debugName;
}
}
}
/**
* initialize the properties
* It will reset the current properties for every Debug instance
*/
public static synchronized void initProperties() {
debugFileNames = new Properties();
// Load properties : debugmap.properties
try {
if (is == null && SystemPropertiesManager.get(DebugConstants.CONFIG_DEBUG_FILEMAP_VARIABLE) != null) {
}
StdDebugFile.printError(DebugImpl.class.getSimpleName(), "Can't read debug files map. '. Please check the" +
} finally {
}
}
}