Class TicketLoggingHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- com.aoapps.hodgepodge.logging.QueuedHandler
-
- com.aoindustries.aoserv.client.ticket.TicketLoggingHandler
-
public class TicketLoggingHandler extends QueuedHandler
An implementation of
Handlerthat logs to the ticket system. It queues log entries and logs them in the background. The log entries are added in the order received, regardless of priority.Will first look for any open/hold/bounced ticket that is for the same brand, account, language, type, level, prefix, classname, method, and category. If found, it will annotate that ticket. If not found, it will create a new ticket.
To minimize resource consumption, this shares one
ExecutorServicefor all handlers, which means tickets are fed to the master(s) sequentially, even across many different connectors.- Author:
- AO Industries, Inc.
-
-
Constructor Summary
Constructors Modifier Constructor Description TicketLoggingHandler()Public constructor required so can be specified inlogging.properties.protectedTicketLoggingHandler(String summaryPrefix, AOServConnector connector, String categoryDotPath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbackgroundPublish(Formatter formatter, LogRecord record, String fullReport)voidclose()Clean-up this handler and any that were garbage collected.static StringgenerateActionSummary(Formatter formatter, LogRecord record)static TicketLoggingHandlergetHandler(String summaryPrefix, AOServConnector connector, String categoryDotPath)Only one TicketLoggingHandler will be created per unique summaryPrefix, AOServConnector, and categoryDotPath.static StringgetPriorityName(Level level)-
Methods inherited from class com.aoapps.hodgepodge.logging.QueuedHandler
flush, newExecutor, publish, shutdownExecutor
-
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
-
-
-
-
Constructor Detail
-
TicketLoggingHandler
protected TicketLoggingHandler(String summaryPrefix, AOServConnector connector, String categoryDotPath)
-
TicketLoggingHandler
public TicketLoggingHandler() throws ConfigurationExceptionPublic constructor required so can be specified inlogging.properties. Supports the following optional settings inlogging.properties:(classname).summaryPrefix- the summary prefix for tickets.(classname).username- the username to login as. When not set, the username fromaoserv-client.propertiesis used.(classname).password- the password to login with. When not set, the password fromaoserv-client.propertiesis used.(classname).categoryDotPath- the category dot path for tickets.
- Throws:
ConfigurationException
-
-
Method Detail
-
getHandler
public static TicketLoggingHandler getHandler(String summaryPrefix, AOServConnector connector, String categoryDotPath)
Only one TicketLoggingHandler will be created per unique summaryPrefix, AOServConnector, and categoryDotPath.
-
close
public void close() throws SecurityExceptionClean-up this handler and any that were garbage collected.- Overrides:
closein classQueuedHandler- Throws:
SecurityException
-
backgroundPublish
protected void backgroundPublish(Formatter formatter, LogRecord record, String fullReport) throws IOException, SQLException
- Specified by:
backgroundPublishin classQueuedHandler- Throws:
IOExceptionSQLException
-
generateActionSummary
public static String generateActionSummary(Formatter formatter, LogRecord record)
-
-