本文整理汇总了Java中org.slf4j.Logger.debug方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.debug方法的具体用法?Java Logger.debug怎么用?Java Logger.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.slf4j.Logger
的用法示例。
在下文中一共展示了Logger.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeESAPI
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* Initializes the OWASPI ESAPI library.
*/
protected static void initializeESAPI() {
Logger log = getLogger();
String systemPropertyKey = "org.owasp.esapi.SecurityConfiguration";
String opensamlConfigImpl = ESAPISecurityConfig.class.getName();
String currentValue = System.getProperty(systemPropertyKey);
if (currentValue == null || currentValue.isEmpty()) {
log.debug("Setting ESAPI SecurityConfiguration impl to OpenSAML internal class: {}", opensamlConfigImpl);
System.setProperty(systemPropertyKey, opensamlConfigImpl);
// We still need to call ESAPI.initialize() despite setting the system property, b/c within the ESAPI class
// the property is only evaluated once in a static initializer and stored. The initialize method however
// does overwrite the statically-set value from the system property. But still set the system property for
// consistency, so other callers can see what has been set.
ESAPI.initialize(opensamlConfigImpl);
} else {
log.debug("ESAPI SecurityConfiguration impl was already set non-null and non-empty via system property, leaving existing value in place: {}",
currentValue);
}
}
示例2: get_mac_addr
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* This is out of date and should be replaced with the built-in parser of MacAddress
* @param n
* @param actionToDecode
* @param log
* @return
*/
private static byte[] get_mac_addr(Matcher n, String actionToDecode, Logger log) {
byte[] macaddr = new byte[6];
for (int i=0; i<6; i++) {
if (n.group(i+1) != null) {
try {
macaddr[i] = get_byte("0x" + n.group(i+1));
}
catch (NumberFormatException e) {
log.debug("Invalid src-mac in: '{}' (error ignored)", actionToDecode);
return null;
}
}
else {
log.debug("Invalid src-mac in: '{}' (null, error ignored)", actionToDecode);
return null;
}
}
return macaddr;
}
示例3: signMAC
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* Compute the Message Authentication Code (MAC) value over the supplied input.
*
* It is up to the caller to ensure that the specified algorithm ID is consistent with the type of signing key
* supplied.
*
* @param signingKey the key with which to compute the MAC
* @param jcaAlgorithmID the Java JCA algorithm ID to use
* @param input the input over which to compute the MAC
* @return the computed MAC value
* @throws SecurityException thrown if the MAC computation results in an error
*/
public static byte[] signMAC(Key signingKey, String jcaAlgorithmID, byte[] input) throws SecurityException {
Logger log = getLogger();
log.debug("Computing MAC over input using key of type {} and JCA algorithm ID {}", signingKey.getAlgorithm(),
jcaAlgorithmID);
try {
Mac mac = Mac.getInstance(jcaAlgorithmID);
mac.init(signingKey);
mac.update(input);
byte[] rawMAC = mac.doFinal();
log.debug("Computed MAC: {}", new String(Hex.encode(rawMAC)));
return rawMAC;
} catch (GeneralSecurityException e) {
log.error("Error during MAC generation", e);
throw new SecurityException("Error during MAC generation", e);
}
}
示例4: ping
import org.slf4j.Logger; //导入方法依赖的package包/类
public static boolean ping(int port, final String expectedMsg) {
boolean beaconExists = false;
try {
Socket socket = new Socket("localhost", port);
final BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
final OutputStream output = socket.getOutputStream();
output.write("ping\n".getBytes());
String response = reader.readLine();
beaconExists = response.equals(expectedMsg);
socket.close();
}
catch (Exception e) {
Logger log = LoggerFactory.getLogger(ActiveAppPinger.class);
if (log.isDebugEnabled()) {
log.debug("Failed to connect to port " + port, e);
}
}
return beaconExists;
}
示例5: clearActionsFromString
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* Convert the string representation of an OFInstructionClearActions to
* an OFInstructionClearActions. The instruction will be set within the
* OFFlowMod.Builder provided. Notice nothing is returned, but the
* side effect is the addition of an instruction in the OFFlowMod.Builder.
* @param fmb; The FMB in which to append the new instruction
* @param instStr; The string to parse the instruction from
* @param log
*/
public static void clearActionsFromString(OFFlowMod.Builder fmb, String inst, Logger log) {
if (fmb.getVersion().compareTo(OFVersion.OF_11) < 0) {
log.error("Clear Actions Instruction not supported in OpenFlow 1.0");
return;
}
if (inst != null && inst.trim().isEmpty()) { /* Allow the empty string, since this is what specifies clear (i.e. key clear does not have any defined values). */
OFInstructionClearActions i = OFFactories.getFactory(fmb.getVersion()).instructions().clearActions();
log.debug("Appending ClearActions instruction: {}", i);
appendInstruction(fmb, i);
log.debug("All instructions after append: {}", fmb.getInstructions());
} else {
log.error("Got non-empty or null string, but ClearActions should not have any String sub-fields: {}", inst);
}
}
示例6: main
import org.slf4j.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {
/**
* 1.测试{@linkplain cn.xishan.oftenporter.porter.core.annotation.Mixin},自己混入自己
*/
final Logger logger = LoggerFactory.getLogger(MainMixinLoop1.class);
LocalMain localMain = new LocalMain(true, new PName("P1"), "utf-8");
// 进行配置
PorterConf conf = localMain.newPorterConf();
conf.setContextName("MainMixinLoop1");
conf.getSeekPackages().addClassPorter(RootPorter.class);
localMain.startOne(conf);
logger.debug("****************************************************");
logger.debug("****************************************************");
localMain.destroyAll();
}
示例7: main
import org.slf4j.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {
/**
* 1.测试{@linkplain cn.xishan.oftenporter.porter.core.annotation.Mixin},自己混入自己
*/
final Logger logger = LoggerFactory.getLogger(MainMixinLoop2.class);
LocalMain localMain = new LocalMain(true, new PName("P1"), "utf-8");
// 进行配置
PorterConf conf = localMain.newPorterConf();
conf.setContextName("MainMixinLoop2");
conf.getSeekPackages().addClassPorter(Root2Porter.class);
localMain.startOne(conf);
logger.debug("****************************************************");
logger.debug("****************************************************");
localMain.destroyAll();
}
示例8: getUnicesPid
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* @param process NiFi Process Reference
* @param logger Logger Reference for Debug
* @return Returns pid or null in-case pid could not be determined
* This method takes {@link Process} and {@link Logger} and returns
* the platform specific ProcessId for Unix like systems, a.k.a <b>pid</b>
* In-case it fails to determine the pid, it will return Null.
* Purpose for the Logger is to log any interaction for debugging.
*/
private static Long getUnicesPid(final Process process, final Logger logger) {
try {
final Class<?> procClass = process.getClass();
final Field pidField = procClass.getDeclaredField("pid");
pidField.setAccessible(true);
final Object pidObject = pidField.get(process);
logger.debug("PID Object = {}", pidObject);
if (pidObject instanceof Number) {
return ((Number) pidObject).longValue();
}
return null;
} catch (final IllegalAccessException | NoSuchFieldException nsfe) {
logger.debug("Could not find PID for child process due to {}", nsfe);
return null;
}
}
示例9: configureLogging
import org.slf4j.Logger; //导入方法依赖的package包/类
private void configureLogging(ApiClient apiClient) {
// Add logging interceptor to HTTP Client if Debug is enabled. Make it configurable?
Logger logger = LoggerFactory.getLogger(PUBLICApi.class);
if (logger.isDebugEnabled()) {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public void log(String msg) {
logger.debug(msg);
}
});
loggingInterceptor.setLevel(Level.BODY);
apiClient.getOkBuilder().addNetworkInterceptor(loggingInterceptor);
}
}
示例10: killProcessTree
import org.slf4j.Logger; //导入方法依赖的package包/类
private void killProcessTree(final String pid, final Logger logger) throws IOException {
logger.debug("Killing Process Tree for PID {}", pid);
final List<String> children = getChildProcesses(pid);
logger.debug("Children of PID {}: {}", new Object[]{pid, children});
for (final String childPid : children) {
killProcessTree(childPid, logger);
}
Runtime.getRuntime().exec(new String[]{"kill", "-9", pid});
}
示例11: closeQuietly
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* Closes the given Closeable quietly.
* @param is the given closeable
* @param log logger used to log any failure should the close fail
*/
public static void closeQuietly(AutoCloseable is, Logger log) {
if (is != null) {
try {
is.close();
} catch (Exception ex) {
Logger logger = log == null ? DEFAULT_LOG : log;
if (logger.isDebugEnabled()) {
logger.debug("Ignore failure in closing the Closeable", ex);
}
}
}
}
示例12: applyActionsFromString
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* Convert the string representation of an OFInstructionApplyActions to
* an OFInstructionApplyActions. The instruction will be set within the
* OFFlowMod.Builder provided. Notice nothing is returned, but the
* side effect is the addition of an instruction in the OFFlowMod.Builder.
* @param fmb; The FMB in which to append the new instruction
* @param instStr; The string to parse the instruction from
* @param log
*/
public static void applyActionsFromString(OFFlowMod.Builder fmb, String inst, Logger log) {
if (fmb.getVersion().compareTo(OFVersion.OF_11) < 0) {
log.error("Apply Actions Instruction not supported in OpenFlow 1.0");
return;
}
OFFlowMod.Builder tmpFmb = OFFactories.getFactory(fmb.getVersion()).buildFlowModify();
OFInstructionApplyActions.Builder ib = OFFactories.getFactory(fmb.getVersion()).instructions().buildApplyActions();
ActionUtils.fromString(tmpFmb, inst, log);
ib.setActions(tmpFmb.getActions());
log.debug("Appending ApplyActions instruction: {}", ib.build());
appendInstruction(fmb, ib.build());
log.debug("All instructions after append: {}", fmb.getInstructions()); }
示例13: isProcessRunning
import org.slf4j.Logger; //导入方法依赖的package包/类
private boolean isProcessRunning(final String pid, final Logger logger) {
try {
// We use the "ps" command to check if the process is still running.
final ProcessBuilder builder = new ProcessBuilder();
builder.command("ps", "-p", pid);
final Process proc = builder.start();
// Look for the pid in the output of the 'ps' command.
boolean running = false;
String line;
try (final InputStream in = proc.getInputStream();
final Reader streamReader = new InputStreamReader(in);
final BufferedReader reader = new BufferedReader(streamReader)) {
while ((line = reader.readLine()) != null) {
if (line.trim().startsWith(pid)) {
running = true;
}
}
}
// If output of the ps command had our PID, the process is running.
if (running) {
logger.debug("Process with PID {} is running", pid);
} else {
logger.debug("Process with PID {} is not running", pid);
}
return running;
} catch (final IOException ioe) {
System.err.println("Failed to determine if Process " + pid + " is running; assuming that it is not");
return false;
}
}
示例14: fetchSakuraSpeedData
import org.slf4j.Logger; //导入方法依赖的package包/类
private void fetchSakuraSpeedData(int retry) {
Logger logger = LoggerFactory.getLogger(AutoRunConfig.class);
if (retry == 0) {
if (logger.isWarnEnabled()) {
logger.warn("fetching sakura speed data failed");
}
} else {
if (logger.isInfoEnabled()) {
logger.info("fetching sakura speed data ({})", retry);
}
try {
sakuraSpeedSpider.fetch();
} catch (IOException e) {
if (logger.isDebugEnabled()) {
logger.debug("fetching sakura speed data throw an error", e);
}
if (retry > 0) {
fetchSakuraSpeedData(retry - 1);
} else {
return;
}
}
if (logger.isInfoEnabled()) {
logger.info("fetched sakura speed data ({})", retry);
}
}
}
示例15: decode_output
import org.slf4j.Logger; //导入方法依赖的package包/类
/**
* Parse string and numerical port representations.
* The key and delimiter for the action should be omitted, and only the
* data should be presented to this decoder. Data can be any signed integer
* as a string or the strings 'controller', 'local', 'ingress-port', 'normal',
* or 'flood'.
* @param actionToDecode; The action as a string to decode
* @param version; The OF version to create the action for
* @param log
* @return
*/
@LogMessageDoc(level="ERROR",
message="Invalid subaction: '{subaction}'",
explanation="A static flow entry contained an invalid subaction",
recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
private static OFActionOutput decode_output(String actionToDecode, OFVersion version, Logger log) {
Matcher n = Pattern.compile("((all)|(controller)|(local)|(ingress-port)|(normal)|(flood))").matcher(actionToDecode);
OFActionOutput.Builder ab = OFFactories.getFactory(version).actions().buildOutput();
OFPort port = OFPort.ANY;
if (n.matches()) {
if (n.group(1) != null && n.group(1).equals("all"))
port = OFPort.ALL;
else if (n.group(1) != null && n.group(1).equals("controller"))
port = OFPort.CONTROLLER;
else if (n.group(1) != null && n.group(1).equals("local"))
port = OFPort.LOCAL;
else if (n.group(1) != null && n.group(1).equals("ingress-port"))
port = OFPort.IN_PORT;
else if (n.group(1) != null && n.group(1).equals("normal"))
port = OFPort.NORMAL;
else if (n.group(1) != null && n.group(1).equals("flood"))
port = OFPort.FLOOD;
ab.setPort(port);
ab.setMaxLen(Integer.MAX_VALUE);
log.debug("action {}", ab.build());
return ab.build();
}
else {
try {
port = OFPort.of(Integer.parseInt(actionToDecode));
ab.setPort(port);
ab.setMaxLen(Integer.MAX_VALUE);
return ab.build();
} catch (NumberFormatException e) {
log.error("Could not parse Integer port: '{}'", actionToDecode);
return null;
}
}
}