当前位置: 首页>>代码示例>>Java>>正文


Java Logger类代码示例

本文整理汇总了Java中org.slf4j.Logger的典型用法代码示例。如果您正苦于以下问题:Java Logger类的具体用法?Java Logger怎么用?Java Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Logger类属于org.slf4j包,在下文中一共展示了Logger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: signObject

import org.slf4j.Logger; //导入依赖的package包/类
/**
 * Signs a single XMLObject.
 * 
 * @param signature the signature to computer the signature on
 * @throws SignatureException thrown if there is an error computing the signature
 */
public static void signObject(Signature signature) throws SignatureException {
    Logger log = getLogger();
    try {
        XMLSignature xmlSignature = ((SignatureImpl) signature).getXMLSignature();

        if (xmlSignature == null) {
            log.error("Unable to compute signature, Signature XMLObject does not have the XMLSignature "
                    + "created during marshalling.");
            throw new SignatureException("XMLObject does not have an XMLSignature instance, unable to compute signature");
        }
        log.debug("Computing signature over XMLSignature object");
        xmlSignature.sign(SecurityHelper.extractSigningKey(signature.getSigningCredential()));
    } catch (XMLSecurityException e) {
        log.error("An error occured computing the digital signature", e);
        throw new SignatureException("Signature computation error", e);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:Signer.java

示例2: listWithoutPath

import org.slf4j.Logger; //导入依赖的package包/类
public static List<String> listWithoutPath(List<String> listWithPrefix, String fixedPath,  Logger log)
{
	final List<String> listWithoutFixedPath;
	listWithoutFixedPath= new ArrayList<String>();
	for (String resourcePath : listWithPrefix)
	{
		if (StringUtils.isNotEmpty(resourcePath))
			if (resourcePath.startsWith(fixedPath))
				listWithoutFixedPath.add(resourcePath.substring(fixedPath.length()));
			else
				log.warn(String.format("Invalid starting path %s, expected to begin with %s", resourcePath, fixedPath));
		else
			log.warn(String.format("Empty path %s", resourcePath));
	}
	return listWithoutFixedPath;
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:17,代码来源:ResourceHelper.java

示例3: validateResource

import org.slf4j.Logger; //导入依赖的package包/类
public static void validateResource(String resourcePath,Logger log) 
{ 

	ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
	try {
		if (resourceResolver.getResources("classpath*:/GameData" +resourcePath+"*").length==0)
			log.error("INEXISTENT RESOURCE "+"/GameData" +resourcePath+"*");
	} catch (IOException e) {
		// TODO Auto-generated catch block 
		e.printStackTrace();
	}
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:13,代码来源:ResourceHelper.java

示例4: getRequestJsonObject

import org.slf4j.Logger; //导入依赖的package包/类
private JsonObject getRequestJsonObject(Logger logger, boolean logFailedRequests) {
    JsonObject chart = new JsonObject();
    chart.addProperty("chartId", chartId);
    try {
        JsonObject data = getChartData();
        if (data == null) {
            // If the data is null we don't send the chart.
            return null;
        }
        chart.add("data", data);
    } catch (Throwable t) {
        if (logFailedRequests) {
            logger.warn("Failed to get data for custom chart with id {}", chartId, t);
        }
        return null;
    }
    return chart;
}
 
开发者ID:codeHusky,项目名称:HuskyUI-Plugin,代码行数:19,代码来源:Metrics.java

示例5: decode_set_vlan_id

import org.slf4j.Logger; //导入依赖的package包/类
/**
 * Parse set_vlan_id actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanVid decode_set_vlan_id(String actionToDecode, OFVersion version, Logger log) {
	Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode);
	if (n.matches()) {            
		if (n.group(1) != null) {
			try {
				VlanVid vlanid = VlanVid.ofVlan(get_short(n.group(1)));
				OFActionSetVlanVid.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanVid();
				ab.setVlanVid(vlanid);
				log.debug("action {}", ab.build());
				return ab.build();
			}
			catch (NumberFormatException e) {
				log.debug("Invalid VLAN in: {} (error ignored)", actionToDecode);
				return null;
			}
		}          
	}
	else {
		log.debug("Invalid action: '{}'", actionToDecode);
		return null;
	}
	return null;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:34,代码来源:ActionUtils.java

示例6: decode_set_tos_bits

import org.slf4j.Logger; //导入依赖的package包/类
/**
 * Parse set_tos actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. A leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetNwTos decode_set_tos_bits(String actionToDecode, OFVersion version, Logger log) {
	Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
	if (n.matches()) {
		if (n.group(1) != null) {
			try {
				byte tosbits = get_byte(n.group(1));
				OFActionSetNwTos.Builder ab = OFFactories.getFactory(version).actions().buildSetNwTos();
				ab.setNwTos(tosbits);
				log.debug("action {}", ab.build());
				return ab.build();
			}
			catch (NumberFormatException e) {
				log.debug("Invalid dst-port in: {} (error ignored)", actionToDecode);
				return null;
			}
		}
	}
	else {
		log.debug("Invalid action: '{}'", actionToDecode);
		return null;
	}
	return null;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:34,代码来源:ActionUtils.java

示例7: NettyClientHandler

import org.slf4j.Logger; //导入依赖的package包/类
public NettyClientHandler(String id, int epoch, String protocol, int affinity, T login, Integer connTimeout, long idleTimeout,
    Logger log, NettyMetricsSink metrics, NettyClient<T> client, NetworkClientCallback<T> callback) {
    this.log = log;
    this.id = id;
    this.epoch = epoch;
    this.protocol = protocol;
    this.affinity = affinity;
    this.login = login;
    this.idleTimeout = idleTimeout;
    this.connTimeout = connTimeout;
    this.metrics = metrics;
    this.client = client;
    this.callback = callback;

    this.debug = log.isDebugEnabled();
    this.trace = log.isTraceEnabled();

    hbOnFlush = future -> {
        hbFlushed = true;

        if (!future.isSuccess() && future.channel().isOpen()) {
            future.channel().pipeline().fireExceptionCaught(future.cause());
        }
    };
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:26,代码来源:NettyClientHandler.java

示例8: logsAndExecutesSteps

import org.slf4j.Logger; //导入依赖的package包/类
/**
 * GithubSteps logs the received comment and author and
 * executes the given steps.
 * @throws Exception If something goes wrong.
 */
@Test
public void logsAndExecutesSteps() throws Exception {
    final Command comment = Mockito.mock(Command.class);
    Mockito.when(comment.json()).thenReturn(
        Json.createObjectBuilder().add("body", "@comdor run").build()
    );
    Mockito.when(comment.author()).thenReturn("amihaiemil");
    final Step toExecute = Mockito.mock(Step.class);
    
    final Steps steps = new GithubSteps(toExecute, comment);
    
    final Log log = Mockito.mock(Log.class);
    final Logger slf4j = Mockito.mock(Logger.class);
    Mockito.when(log.logger()).thenReturn(slf4j);
    
    steps.perform(log);
    
    Mockito.verify(slf4j).info("Received command: @comdor run");
    Mockito.verify(slf4j).info("Author login: amihaiemil");
    Mockito.verify(toExecute).perform(comment, log);
}
 
开发者ID:amihaiemil,项目名称:comdor,代码行数:27,代码来源:GithubStepsTestCase.java

示例9: logHistorySteps

import org.slf4j.Logger; //导入依赖的package包/类
/** 
 *  Write out the state the all the history steps. 
 */

public static void logHistorySteps(Logger logger, long piid, OSWfEngine wfEngine) {
        
    List<Step> steps = wfEngine.getHistorySteps(piid);
    WorkflowDescriptor wfDescriptor = wfEngine.getWorkflowDescriptor(wfEngine.getWorkflowName(piid));

    if(steps.size() > 0) 
        for (Step step : steps) 
            logger.debug(String.format("History Step: %3d %-20s %s  ",   // %3s-%3s
                step.getStepId(),
                wfDescriptor.getStep(step.getStepId()).getName(),
                step.getStatus()
                // dateFormatter.format(step.getStartDate()),
                // dateFormatter.format(step.getFinishDate())
            ));
   else
        logger.debug("No available history steps");
}
 
开发者ID:will-gilbert,项目名称:OSWf-OSWorkflow-fork,代码行数:22,代码来源:OSWfLogging.java

示例10: pluginHealthCheck

import org.slf4j.Logger; //导入依赖的package包/类
protected void pluginHealthCheck() {
    ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();

    scheduledExecutorService.scheduleWithFixedDelay(new Runnable() {
        private final Logger CHECKLOGGER = LoggerFactory.getLogger(AbstractPluginManager.class);

        @Override
        public void run() {
            for (Plugin p : context.getPluginMap().values()) {
                if (p.getStatus().equals(PluginStatus.ERROR)) {
                    CHECKLOGGER.error("HEALTH CHECK - Plugin {} is in error.", p.getName());
                    p.disable();
                }
            }
        }
    }, 0, 1, TimeUnit.SECONDS);
}
 
开发者ID:MatteoJoliveau,项目名称:PlugFace,代码行数:18,代码来源:AbstractPluginManager.java

示例11: createRegisterLogger

import org.slf4j.Logger; //导入依赖的package包/类
public static Slf4jDdsLogger createRegisterLogger() throws IOException {
  // create logger
  Slf4jDdsLogger slf4jDdsLogger = new Slf4jDdsLogger();

  // register logger
  com.rti.ndds.config.Logger.get_instance().set_output_device(slf4jDdsLogger);
  com.rti.ndds.config.Logger.get_instance().set_print_format(LogPrintFormat.NDDS_CONFIG_LOG_PRINT_FORMAT_TIMESTAMPED);

  // set log level
  if (LOGGER.isTraceEnabled()) {
    com.rti.ndds.config.Logger.get_instance().set_verbosity(LogVerbosity.NDDS_CONFIG_LOG_VERBOSITY_STATUS_ALL);
  } else if (LOGGER.isWarnEnabled()) {
    com.rti.ndds.config.Logger.get_instance().set_verbosity(LogVerbosity.NDDS_CONFIG_LOG_VERBOSITY_WARNING);
  } else if (LOGGER.isErrorEnabled()) {
    com.rti.ndds.config.Logger.get_instance().set_verbosity(LogVerbosity.NDDS_CONFIG_LOG_VERBOSITY_ERROR);
  }

  // return logger
  return slf4jDdsLogger;
}
 
开发者ID:aguther,项目名称:dds-examples,代码行数:21,代码来源:Slf4jDdsLogger.java

示例12: close

import org.slf4j.Logger; //导入依赖的package包/类
public static void close(ThreadPoolExecutor executor, Logger logger) {
  executor.shutdown(); // Disable new tasks from being submitted
  try {
    // Wait a while for existing tasks to terminate
    if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
      executor.shutdownNow(); // Cancel currently executing tasks
      // Wait a while for tasks to respond to being cancelled
      if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
        logger.error("Pool did not terminate");
      }
    }
  } catch (InterruptedException ie) {
    logger.warn("Executor interrupted while awaiting termination");

    // (Re-)Cancel if current thread also interrupted
    executor.shutdownNow();
    // Preserve interrupt status
    Thread.currentThread().interrupt();
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:21,代码来源:AutoCloseables.java

示例13: exParamDeal

import org.slf4j.Logger; //导入依赖的package包/类
private void exParamDeal(WObject wObject, PorterOfFun porterOfFun, ParamDealt.FailedReason reason,
        boolean responseWhenException)
{
    Logger LOGGER = logger(wObject);
    JResponse jResponse = null;
    if (LOGGER.isDebugEnabled() || responseWhenException)
    {
        jResponse = toJResponse(reason, wObject);
        LOGGER.debug("{}:{}", wObject.url(), jResponse);
    }
    if (responseWhenException)
    {
        if (jResponse == null)
        {
            jResponse = toJResponse(reason, wObject);
        }
        doFinalWrite(wObject, porterOfFun, jResponse);
    }
    close(wObject);
}
 
开发者ID:gzxishan,项目名称:OftenPorter,代码行数:21,代码来源:PortExecutor.java

示例14: main

import org.slf4j.Logger; //导入依赖的package包/类
/**
 * The entry point of application.
 *
 * @param args the command line arguments
 */
public static void main(String[] args) {
    Logger logger = LoggerFactory.getLogger(GUILabelingTool.class);
    System.getProperty("java.library.path");

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(() -> {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            //  SplashScreen.startSplash()

            GUILabelingTool gui = new GUILabelingTool(logger);
            gui.setVisible(true);
            // for the first run, some special configuration have to be done
            gui.firstStartInitialization();

        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            logger.error("Create and display form");
            logger.debug("Create and display form {}", ex);
        }
    });
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:27,代码来源:GUILabelingTool.java

示例15: VirtualTool

import org.slf4j.Logger; //导入依赖的package包/类
@Inject
public VirtualTool(@ConfigDir(sharedRoot = true) Path path, Logger logger, PluginContainer container) {
    this.dataDir = Sponge.getGame().getSavesDirectory().resolve(PluginData.id);
    this.pluginContainer = container;
    this.logger = new VTLogger(CText.get(CText.Colors.BLUE, 1, "V") + CText.get(CText.Colors.MAGENTA, 0, "T"));
    this.configdirpath = path.resolve(PluginData.id);
    this.backpackDir = Paths.get(this.getConfigPath().toString(), "backpacks");
    this.configfullpath = Paths.get(this.getConfigPath().toString(), "config.json");
    this.settings = new Settings();
}
 
开发者ID:poqdavid,项目名称:VirtualTool,代码行数:11,代码来源:VirtualTool.java


注:本文中的org.slf4j.Logger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。