本文整理汇总了Java中org.apache.log4j.helpers.LogLog.debug方法的典型用法代码示例。如果您正苦于以下问题:Java LogLog.debug方法的具体用法?Java LogLog.debug怎么用?Java LogLog.debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.log4j.helpers.LogLog
的用法示例。
在下文中一共展示了LogLog.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
* When system exit,this method will be called to close resources
*/
public synchronized void close() {
// The synchronized modifier avoids concurrent append and close operations
if (this.closed)
return;
LogLog.debug("Closing RocketmqLog4jAppender [" + name + "].");
this.closed = true;
try {
ProducerInstance.removeAndClose(this.nameServerAddress, this.producerGroup);
} catch (Exception e) {
LogLog.error("Closing RocketmqLog4jAppender [" + name + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
}
// Help garbage collection
producer = null;
}
示例2: configure
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/** Overwrites the jlogger field on the base class with a JDBCLoggerWithAttachment instance if:
* <ul>
* <li> Attachment settings are provided in the configuration file
* <li> The usePreparedStatements should be true
* <li> The stored-procedure, sql and sqlHandler should not be specified.
* </ul>
* Finally it invokes the configure() method in the base class.
* @return true if the configuration was successful.
*/
protected boolean configure() {
try {
if (!((Boolean) c_configured.get(this)).booleanValue()) {
// Customize the logger if attachmentTable and attachmentMDCKey are provided and if using prepared statements.
// Ensure that stored-procedure, sql or sqlHandler are not being used.
if (getAttachmentTable() != null && getAttachmentMDCKey() != null && isUsePreparedStatements()
&& getProcedure() == null && getSql() == null) {
// Use reflection to check the 'sqlHandler' field from the base class, since there is no getter
if (c_sqlHandler.get(this) == null) {
// Use reflection to set the 'jlogger' field on the base class, since there is no setter
c_jlogger.set(this, new JDBCLoggerWithAttachment(getAttachmentTable(), getAttachmentMDCKey(), getEngine()));
LogLog.debug("JDBCAppenderWithAttachment::configure(), Using JDBCLoggerWithAttachment");
}
}
return super.configure();
} else
return true;
} catch (Exception e) {
String errorMsg = "JDBCAppenderWithAttachment::configure()";
LogLog.error(errorMsg, e);
errorHandler.error(errorMsg, e, 0);
return false;
}
}
示例3: tryClientFactory
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
* Attempts to use a factory method to create the service client.
*
* @param clientFactoryName Fully qualified name of a static factory method.
* If empty or null, this function returns null (used
* to handle optionally-configured factories).
* @param expectedClientClass The interface fullfilled by this client.
* @param rethrow If true, any reflection exceptions will be wrapped
* and rethrown; if false, exceptions return null
*/
protected <T> T tryClientFactory(String clientFactoryName, Class<T> expectedClientClass, boolean rethrow)
{
if ((clientFactoryName == null) || clientFactoryName.isEmpty())
return null;
try
{
int methodIdx = clientFactoryName.lastIndexOf('.');
if (methodIdx < 0)
throw new RuntimeException("invalid AWS client factory specified: " + clientFactoryName);
Class<?> factoryKlass = Class.forName(clientFactoryName.substring(0, methodIdx));
Method factoryMethod = factoryKlass.getDeclaredMethod(clientFactoryName.substring(methodIdx + 1));
T client = expectedClientClass.cast(factoryMethod.invoke(null));
factoryMethodUsed = clientFactoryName;
LogLog.debug(getClass().getSimpleName() + ": created client from factory: " + clientFactoryName);
return client;
}
catch (Exception ex)
{
if (rethrow)
throw new RuntimeException("unable to invoke AWS client factory", ex);
else
return null;
}
}
示例4: tryConfigureEndpointOrRegion
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
* Common support code: attempts to configure client endpoint and/or region.
*
* @param client A constructed writer-specific service client.
* @param endpoint A possibly-null endpoint specification.
*/
protected <T extends AmazonWebServiceClient> T tryConfigureEndpointOrRegion(T client, String endpoint)
{
// explicit endpoint takes precedence over region retrieved from environment
if (endpoint != null)
{
LogLog.debug(getClass().getSimpleName() + ": configuring endpoint: " + endpoint);
client.setEndpoint(endpoint);
return client;
}
String region = System.getenv("AWS_REGION");
if (region != null)
{
LogLog.debug(getClass().getSimpleName() + ": configuring region: " + region);
client.configureRegion(Regions.fromName(region));
return client;
}
return client;
}
示例5: subAppend
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
@Override
protected void subAppend(LoggingEvent event)
{
LogLog.debug("subAppend");
long now = System.currentTimeMillis();
if( now >= nextRollTime )
{
LogLog.debug("Have to roll directory");
calculateRollOverTime();
rollDirectory();
}
else if( getFile() != null && ((CountingQuietWriter) qw).getCount() >= maxFileSize )
{
LogLog.debug("Have to roll file");
rollFile();
}
LogLog.debug("Calling Super Sub Append");
super.subAppend(event);
}
示例6: close
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
* When system exit,this method will be called to close resources
*/
public synchronized void close() {
// The synchronized modifier avoids concurrent append and close operations
if (this.closed)
return;
LogLog.debug("Closing RocketmqLog4jAppender [" + name + "].");
this.closed = true;
try {
ProducerInstance.getProducerInstance().removeAndClose(this.nameServerAddress, this.producerGroup);
} catch (Exception e) {
LogLog.error("Closing RocketmqLog4jAppender [" + name + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
}
// Help garbage collection
producer = null;
}
示例7: setFile
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
<p>Sets and <i>opens</i> the file where the log output will
go. The specified file must be writable.
<p>If there was already an opened file, then the previous file
is closed first.
<p><b>Do not use this method directly. To configure a FileAppender
or one of its subclasses, set its properties one by one and then
call activateOptions.</b>
@param fileName The path to the log file.
@param append If true will append to fileName. Otherwise will
truncate fileName. */
protected synchronized void setFile(boolean append) throws IOException {
LogLog.debug("setFile called: "+res+", "+append);
// It does not make sense to have immediate flush and bufferedIO.
if(bufferedIO) {
setImmediateFlush(false);
}
reset();
Resource parent = res.getParentResource();
if(!parent.exists()) parent.createDirectory(true);
boolean writeHeader = !append || res.length()==0;// this must happen before we open the stream
Writer fw = createWriter(new RetireOutputStream(res, append, timeout,listener));
if(bufferedIO) {
fw = new BufferedWriter(fw, bufferSize);
}
this.setQWForFiles(fw);
if(writeHeader) writeHeader();
LogLog.debug("setFile ended");
}
示例8: printPeriodicity
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
void printPeriodicity(int type) {
switch (type) {
case TOP_OF_MINUTE:
LogLog.debug("Appender [[+name+]] to be rolled every minute.");
break;
case TOP_OF_HOUR:
LogLog.debug("Appender [" + name + "] to be rolled on top of every hour.");
break;
case HALF_DAY:
LogLog.debug("Appender [" + name + "] to be rolled at midday and midnight.");
break;
case TOP_OF_DAY:
LogLog.debug("Appender [" + name + "] to be rolled at midnight.");
break;
case TOP_OF_WEEK:
LogLog.debug("Appender [" + name + "] to be rolled at start of week.");
break;
case TOP_OF_MONTH:
LogLog.debug("Appender [" + name + "] to be rolled at start of every month.");
break;
default:
LogLog.warn("Unknown periodicity for appender [[+name+]].");
}
}
示例9: stopMonitor
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
/**
Stops the monitor. This method will not return until
the thread has finished executing. */
public synchronized void stopMonitor() {
if (keepRunning) {
LogLog.debug("server monitor thread shutting down");
keepRunning = false;
try {
if (serverSocket != null) {
serverSocket.close();
serverSocket = null;
}
} catch (IOException ioe) {}
try {
monitorThread.join();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
// do nothing?
}
// release the thread
monitorThread = null;
LogLog.debug("server monitor thread shut down");
}
}
示例10: activateOptions
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
public void activateOptions() {
super.activateOptions();
LogLog.debug("Max backup file kept: " + maxBackupIndex + ".");
if (datePattern != null && fileName != null) {
now.setTime(System.currentTimeMillis());
sdf = new SimpleDateFormat(datePattern);
int type = computeCheckPeriod();
printPeriodicity(type);
rpc.setType(type);
File file = new File(fileName);
scheduledFilename = fileName + sdf.format(new Date(file.lastModified()));
} else {
LogLog.error("Either File or DatePattern options are not set for appender [" + name + "].");
}
}
示例11: run
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
public void run() {
try {
String line = dis.readUTF();
LogLog.debug("Got external roll over signal.");
if(ExternallyRolledFileAppender.ROLL_OVER.equals(line)) {
synchronized(er) {
er.rollOver();
}
dos.writeUTF(ExternallyRolledFileAppender.OK);
}
else {
dos.writeUTF("Expecting [RollOver] string.");
}
dos.close();
}
catch(Exception e) {
LogLog.error("Unexpected exception. Exiting HUPNode.", e);
}
}
示例12: printPeriodicity
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
void printPeriodicity(int type) {
switch(type) {
case TOP_OF_MINUTE:
LogLog.debug("Appender ["+name+"] to be rolled every minute.");
break;
case TOP_OF_HOUR:
LogLog.debug("Appender ["+name
+"] to be rolled on top of every hour.");
break;
case HALF_DAY:
LogLog.debug("Appender ["+name
+"] to be rolled at midday and midnight.");
break;
case TOP_OF_DAY:
LogLog.debug("Appender ["+name
+"] to be rolled at midnight.");
break;
case TOP_OF_WEEK:
LogLog.debug("Appender ["+name
+"] to be rolled at start of week.");
break;
case TOP_OF_MONTH:
LogLog.debug("Appender ["+name
+"] to be rolled at start of every month.");
break;
default:
LogLog.warn("Unknown periodicity for appender ["+name+"].");
}
}
示例13: createStatement
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
private Statement createStatement() throws Exception {
Statement retVal = null;
if (this.isUsePreparedStatements()) {
// create sql statement
if (this.preparedSql == null) {
String sql = "insert into " + table + " (" + column_list + ") values (";
for (int i = 0; i < num; i++) {
JDBCLogColumn logcol = (JDBCLogColumn) logcols.get(i);
// only required columns
if (!logcol.ignore) {
// add , if required
if (sql.endsWith(" ")) {
sql += ", ";
}
if (logcol.logtype == JDBCLogType.ORACLE_SEQUENCE) {
sql += logcol.value.toString() + ".NEXTVAL ";
} else {
sql += "? ";
}
}
}
sql += ")";
LogLog.debug("prepared statement: " + sql);
this.preparedSql = sql;
}
retVal = con.prepareStatement(this.preparedSql);
} else {
retVal = con.createStatement();
}
return retVal;
}
示例14: activateOptions
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
public void activateOptions() {
LogLog.debug("Getting initial context.");
if (!checkEntryConditions()) {
return;
}
try {
producer = ProducerInstance.getInstance(nameServerAddress, producerGroup);
} catch (Exception e) {
LogLog.error("activateOptions nameserver:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
}
}
示例15: createAWSClient
import org.apache.log4j.helpers.LogLog; //导入方法依赖的package包/类
@Override
protected void createAWSClient()
{
client = tryClientFactory(config.clientFactoryMethod, AmazonKinesis.class, true);
if ((client == null) && (config.clientEndpoint == null))
{
client = tryClientFactory("com.amazonaws.services.kinesis.AmazonKinesisClientBuilder.defaultClient", AmazonKinesis.class, false);
}
if (client == null)
{
LogLog.debug(getClass().getSimpleName() + ": creating service client via constructor");
client = tryConfigureEndpointOrRegion(new AmazonKinesisClient(), config.clientEndpoint);
}
}