Tabnine Logo
ErrorHandler.error
Code IndexAdd Tabnine to your IDE (free)

How to use
error
method
in
org.apache.logging.log4j.core.ErrorHandler

Best Java code snippets using org.apache.logging.log4j.core.ErrorHandler.error (Showing top 15 results out of 315)

origin: apache/rocketmq

protected RocketmqLog4j2Appender(String name, Filter filter, Layout<? extends Serializable> layout,
  boolean ignoreExceptions, String nameServerAddress, String producerGroup,
  String topic, String tag) {
  super(name, filter, layout, ignoreExceptions);
  this.producer = producer;
  this.topic = topic;
  this.tag = tag;
  this.nameServerAddress = nameServerAddress;
  this.producerGroup = producerGroup;
  try {
    this.producer = ProducerInstance.getProducerInstance().getInstance(this.nameServerAddress, this.producerGroup);
  } catch (Exception e) {
    ErrorHandler handler = this.getHandler();
    if (handler != null) {
      handler.error("Starting RocketmqLog4j2Appender [" + this.getName()
        + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
    }
  }
}
origin: apache/rocketmq

/**
 * Info,error,warn,callback method implementation
 */
public void append(LogEvent event) {
  if (null == producer) {
    return;
  }
  byte[] data = this.getLayout().toByteArray(event);
  try {
    Message msg = new Message(topic, tag, data);
    msg.getProperties().put(ProducerInstance.APPENDER_TYPE, ProducerInstance.LOG4J2_APPENDER);
    //Send message and do not wait for the ack from the message broker.
    producer.sendOneway(msg);
  } catch (Exception e) {
    ErrorHandler handler = this.getHandler();
    if (handler != null) {
      String msg = new String(data);
      handler.error("Could not send message in RocketmqLog4j2Appender [" + this.getName() + "].Message is : " + msg, e);
    }
  }
}
origin: apache/rocketmq

/**
 * When system exit,this method will be called to close resources
 */
public boolean stop(long timeout, TimeUnit timeUnit) {
  this.setStopping();
  try {
    ProducerInstance.getProducerInstance().removeAndClose(this.nameServerAddress, this.producerGroup);
  } catch (Exception e) {
    ErrorHandler handler = this.getHandler();
    if (handler != null) {
      handler.error("Closeing RocketmqLog4j2Appender [" + this.getName()
        + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
    }
  }
  boolean stopped = super.stop(timeout, timeUnit, false);
  this.setStopped();
  return stopped;
}
origin: didi/DDMQ

protected RocketmqLog4j2Appender(String name, Filter filter, Layout<? extends Serializable> layout,
  boolean ignoreExceptions, String nameServerAddress, String producerGroup,
  String topic, String tag) {
  super(name, filter, layout, ignoreExceptions);
  this.producer = producer;
  this.topic = topic;
  this.tag = tag;
  this.nameServerAddress = nameServerAddress;
  this.producerGroup = producerGroup;
  try {
    this.producer = ProducerInstance.getProducerInstance().getInstance(this.nameServerAddress, this.producerGroup);
  } catch (Exception e) {
    ErrorHandler handler = this.getHandler();
    if (handler != null) {
      handler.error("Starting RocketmqLog4j2Appender [" + this.getName()
        + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
    }
  }
}
origin: didi/DDMQ

/**
 * Info,error,warn,callback method implementation
 */
public void append(LogEvent event) {
  if (null == producer) {
    return;
  }
  byte[] data = this.getLayout().toByteArray(event);
  try {
    Message msg = new Message(topic, tag, data);
    msg.getProperties().put(ProducerInstance.APPENDER_TYPE, ProducerInstance.LOG4J2_APPENDER);
    //Send message and do not wait for the ack from the message broker.
    producer.sendOneway(msg);
  } catch (Exception e) {
    ErrorHandler handler = this.getHandler();
    if (handler != null) {
      String msg = new String(data);
      handler.error("Could not send message in RocketmqLog4j2Appender [" + this.getName() + "].Message is : " + msg, e);
    }
  }
}
origin: didi/DDMQ

/**
 * When system exit,this method will be called to close resources
 */
public boolean stop(long timeout, TimeUnit timeUnit) {
  this.setStopping();
  try {
    ProducerInstance.getProducerInstance().removeAndClose(this.nameServerAddress, this.producerGroup);
  } catch (Exception e) {
    ErrorHandler handler = this.getHandler();
    if (handler != null) {
      handler.error("Closeing RocketmqLog4j2Appender [" + this.getName()
        + "] nameServerAddress:" + nameServerAddress + " group:" + producerGroup + " " + e.getMessage());
    }
  }
  boolean stopped = super.stop(timeout, timeUnit, false);
  this.setStopped();
  return stopped;
}
origin: ops4j/org.ops4j.pax.logging

/**
 * Handle an error with a message using the {@link ErrorHandler} configured for this Appender.
 * 
 * @param msg The message.
 */
public void error(final String msg) {
  handler.error(msg);
}
origin: ops4j/org.ops4j.pax.logging

/**
 * Handle an error with a message, exception, and a logging event, using the {@link ErrorHandler} configured for
 * this Appender.
 * 
 * @param msg The message.
 * @param event The LogEvent.
 * @param t The Throwable.
 */
public void error(final String msg, final LogEvent event, final Throwable t) {
  handler.error(msg, event, t);
}
origin: ops4j/org.ops4j.pax.logging

/**
 * Handle an error with a message and an exception using the {@link ErrorHandler} configured for this Appender.
 * 
 * @param msg The message.
 * @param t The Throwable.
 */
public void error(final String msg, final Throwable t) {
  handler.error(msg, t);
}
origin: ops4j/org.ops4j.pax.logging

private String appenderErrorHandlerMessage(final String prefix) {
  final String result = createErrorMsg(prefix);
  appender.getHandler().error(result);
  return result;
}
origin: com.vlkan.log4j2/log4j2-redis-appender

private synchronized void changeState(State initialState, State transitionState, State finalState, Runnable body) {
  logger.debug("expecting state: %s", initialState);
  if (initialState != state) {
    String message = String.format("expecting: %s, found: %s", initialState, state);
    errorHandler.error(message);
    throw new IllegalStateException(message);
  }
  logger.debug("transitioning state: %s", transitionState);
  state = transitionState;
  try {
    if (body != null) {
      body.run();
    }
    logger.debug("finalizing state: %s", finalState);
    state = finalState;
  } catch (Exception error) {
    String message = String.format(
        "state change failure (initialState=%s, transitionState=%s, finalState=%s)",
        initialState, transitionState, finalState);
    if (debugEnabled) {
      logger.debug("%s: %s", message, error.getMessage());
      error.printStackTrace();
    }
    errorHandler.error(message, error);
    throw new RuntimeException(message, error);
  }
}
origin: ops4j/org.ops4j.pax.logging

private void handleAppenderError(final RuntimeException ex) {
  appender.getHandler().error(createErrorMsg("An exception occurred processing Appender "), ex);
  if (!appender.ignoreExceptions()) {
    throw ex;
  }
}
origin: spring-projects/spring-amqp

  getHandler().error("Could not send log message " + logEvent.getMessage()
      + " after " + this.manager.maxSenderRetries + " retries", logEvent, e);
getHandler().error("Could not send log message " + logEvent.getMessage(), logEvent, e);
origin: org.springframework.amqp/spring-rabbit

  getHandler().error("Could not send log message " + logEvent.getMessage()
      + " after " + this.manager.maxSenderRetries + " retries", logEvent, e);
getHandler().error("Could not send log message " + logEvent.getMessage(), logEvent, e);
origin: org.dblock.log4jna/log4jna-api

/** 
 * {@inheritDoc}
 */
public void append(LogEvent event) {
  if (_handle == null) {
    registerEventSource();
  }
  String s = new String(getLayout().toByteArray(event));
  final int messageID = 0x1000;
  String[] buffer = { s };
  if (Advapi32.INSTANCE.ReportEvent(_handle, getEventLogType(event.getLevel()),
      getEventLogCategory(event.getLevel()), messageID, null, buffer.length, 0, buffer, null) == false) {
    Exception e = new Win32Exception(Kernel32.INSTANCE.GetLastError());
    getHandler().error("Failed to report event [" + s + "].", event, e);
  }
}
org.apache.logging.log4j.coreErrorHandlererror

Javadoc

Handle an error with a message.

Popular methods of ErrorHandler

    Popular in Java

    • Making http post requests using okhttp
    • setRequestProperty (URLConnection)
    • getApplicationContext (Context)
    • getExternalFilesDir (Context)
    • HttpURLConnection (java.net)
      An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
    • SocketTimeoutException (java.net)
      This exception is thrown when a timeout expired on a socket read or accept operation.
    • Scanner (java.util)
      A parser that parses a text string of primitive types and strings with the help of regular expressio
    • Set (java.util)
      A Set is a data structure which does not allow duplicate elements.
    • DataSource (javax.sql)
      An interface for the creation of Connection objects which represent a connection to a database. This
    • Reflections (org.reflections)
      Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
    • Top plugins for WebStorm
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now