List of usage examples for java.util.logging Logger log
public void log(Level level, Throwable thrown, Supplier<String> msgSupplier)
From source file:nl.strohalm.cyclos.utils.logging.LoggingHandlerImpl.java
/** * Log a tax error/* www . jav a 2s.co m*/ */ @Override public void logAccountFeeError(final AccountFeeLog feeLog, final Throwable error) { final Logger logger = getAccountFeeLogger(); final Level level = AccountFeeLevel.ERRORS.getLevel(); if (logger.isLoggable(level)) { try { logger.log(level, "Error on " + feeLog.getAccountFee().getName(), error); } catch (final Exception e) { System.out .println("Error generating log on " + settingsService.getLogSettings().getAccountFeeFile()); } } }
From source file:nl.strohalm.cyclos.utils.logging.LoggingHandlerImpl.java
@Override public void logScheduledTaskError(final String taskName, final Calendar hour, final Exception error) { final Logger logger = getScheduledTaskLogger(); final Level level = ScheduledTaskLevel.ERRORS.getLevel(); if (logger.isLoggable(level)) { try {//from ww w.jav a 2s .com logger.log(level, "Exception on scheduled task: " + taskName + " for hour " + FormatObject.formatObject(hour), error); } catch (final Exception e) { System.out.println( "Error generating log on " + settingsService.getLogSettings().getScheduledTaskFile()); } } }
From source file:nl.strohalm.cyclos.utils.logging.LoggingHandler.java
/** * Logs an action error/*from ww w . j a va2 s . co m*/ */ public void traceError(final User user, final Permission permission, final Method method, final Object[] args, final Throwable t) { final Logger logger = getTraceLogger(); final Level level = TraceLevel.ERRORS.getLevel(); if (logger.isLoggable(level)) { try { logger.log(level, "Error on " + buildActionString(user, permission, method, args, null, false), t); } catch (final Exception e) { System.out.println( "Error generating error log on " + settingsService.getLogSettings().getTraceFile()); } } }
From source file:nl.strohalm.cyclos.utils.logging.LoggingHandler.java
/** * Log a tax error/* w ww . j a v a 2 s . c om*/ */ public void logAccountFeeError(final AccountFeeLog feeLog, final Throwable error) { final Logger logger = getAccountFeeLogger(); final Level level = AccountFeeLevel.ERRORS.getLevel(); if (logger.isLoggable(level)) { try { logger.log(level, "Error on " + feeLog.getAccountFee().getName(), error); } catch (final Exception e) { System.out .println("Error generating log on " + settingsService.getLogSettings().getAccountFeeFile()); } } }
From source file:nl.strohalm.cyclos.utils.logging.LoggingHandler.java
/** * Log a scheduled task error//from w ww .j ava2 s.c om */ public void logScheduledTaskError(final String taskName, final Exception error) { final Logger logger = getScheduledTaskLogger(); final Level level = ScheduledTaskLevel.ERRORS.getLevel(); if (logger.isLoggable(level)) { try { logger.log(level, "Exception on scheduled task: " + taskName, error); } catch (final Exception e) { System.out.println( "Error generating log on " + settingsService.getLogSettings().getScheduledTaskFile()); } } }
From source file:org.protempa.backend.dsb.relationaldb.AbstractSQLGenerator.java
private <P extends Proposition> void generateAndExecuteSelectStreaming(EntitySpec entitySpec, ReferenceSpec referenceSpec, Set<String> propIds, Set<Filter> filtersCopy, List<EntitySpec> entitySpecsCopy, LinkedHashMap<String, ReferenceSpec> inboundRefSpecs, Set<String> keyIds, SQLOrderBy order, StreamingResultProcessor<P> resultProcessor, StreamingSQLExecutor executor, boolean wrapKeyId) throws DataSourceReadException { Logger logger = SQLGenUtil.logger(); String backendNameForMessages = backendNameForMessages(); String entitySpecName = entitySpec.getName(); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Data source backend {0} is generating query for {1}", new Object[] { backendNameForMessages, entitySpecName }); }/* w w w . j ava 2s. c om*/ String query = getSelectStatement(entitySpec, referenceSpec, entitySpecsCopy, inboundRefSpecs, filtersCopy, propIds, keyIds, order, resultProcessor, this.stagedTableSpecs, wrapKeyId).generateStatement(); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Data source backend {0} generated the following query for {1}: {2}", new Object[] { backendNameForMessages, entitySpecName, query }); } executor.executeSelect(entitySpecName, query, resultProcessor); }
From source file:nl.strohalm.cyclos.utils.logging.LoggingHandlerImpl.java
@Override public void traceRest(final RestLogDTO params) { Logger logger = getRestLogger(); boolean isError = params.getError() != null; WebServiceLogPrepareResult result = prepareWebService(logger, isError); if (result.logLevel != null) { final String message = buildRestString(params, result.logParameters); try {/*w ww .ja v a 2 s. c o m*/ logger.log(result.logLevel, message, params.getError()); } catch (final Exception e) { System.out .println("Error generating log on " + settingsService.getLogSettings().getWebServiceFile()); } } }
From source file:jp.ikedam.jenkins.plugins.extensible_choice_parameter.ExtensibleChoiceParameterDefinitionJenkinsTest.java
/** * @param def/*w ww . j a v a 2 s. c o m*/ * @param value * @return * @throws Exception */ private EnvVars runBuildWithSelectParameter(ParameterDefinition def, String value) throws Exception { FreeStyleProject job = j.createFreeStyleProject(); job.addProperty(new ParametersDefinitionProperty(def)); CaptureEnvironmentBuilder ceb = new CaptureEnvironmentBuilder(); job.getBuildersList().add(ceb); WebClient wc = j.createAllow405WebClient(); HtmlPage page = wc.getPage(job, "build?delay=0sec"); HtmlForm form = null; try { form = page.getFormByName("parameters"); } catch (ElementNotFoundException e) { Logger logger = Logger.getLogger(this.getClass().getName()); logger.log(Level.SEVERE, "Failed to retrieve parameter form", e); logger.severe(page.asXml()); throw e; } try { HtmlSelect select = form.getSelectByName("value"); HtmlOption opt; try { opt = select.getOptionByText(value); } catch (ElementNotFoundException e) { int newOptPos = select.getOptionSize(); // There's no such option, so create new option tag. DomElement newOpt = page.createElement("option"); // this seems trim the value... //newOpt.setAttribute("value", value); newOpt.appendChild(page.createTextNode(value)); select.appendChild(newOpt); opt = select.getOption(newOptPos); opt.setValueAttribute(value); } opt.setSelected(true); } catch (ElementNotFoundException e) { // selectbox was not found. // selectbox is replaced with input field. HtmlTextInput input = (HtmlTextInput) form.getInputByName("value"); input.setValueAttribute(value); } j.submit(form); j.waitUntilNoActivity(); job.delete(); return ceb.getEnvVars(); }
From source file:nl.strohalm.cyclos.utils.logging.LoggingHandler.java
private void error(final Logger logger, final Level logLevel, final String logFile, final String remoteAddress, final String message, final Throwable th) { if (logLevel != null) { try {// w ww .jav a2 s.c o m final String prefix = StringUtils.isEmpty(remoteAddress) ? "" : remoteAddress + " - "; logger.log(logLevel, prefix + message, th); } catch (final Exception e) { System.out.printf("Error generating error log on %1$s: %2$s%n", logFile, e.getMessage()); } } }
From source file:nl.strohalm.cyclos.utils.logging.LoggingHandlerImpl.java
@Override public void traceWebService(final WebServiceLogDTO params) { final Logger logger = getWebServiceLogger(); boolean isError = params.getError() != null || StringUtils.isNotEmpty(params.getErrorMessage()); WebServiceLogPrepareResult result = prepareWebService(logger, isError); if (result.logLevel != null) { final String message = buildWebServiceString(params, result.logParameters); try {/*from w w w .j a v a 2s . co m*/ logger.log(result.logLevel, message, params.getError()); } catch (final Exception e) { System.out .println("Error generating log on " + settingsService.getLogSettings().getWebServiceFile()); } } }