本文整理汇总了Java中org.jivesoftware.util.Log.debug方法的典型用法代码示例。如果您正苦于以下问题:Java Log.debug方法的具体用法?Java Log.debug怎么用?Java Log.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.util.Log
的用法示例。
在下文中一共展示了Log.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterWrite
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest)
throws Exception {
// Get number of pending requests
int pendingBytes = session.getScheduledWriteBytes();
if (pendingBytes > bytesCap) {
// Get last time we were able to send something to the connected client
long writeTime = session.getLastWriteTime();
int pendingRequests = session.getScheduledWriteRequests();
Log.debug("About to kill session with pendingBytes: " + pendingBytes + " pendingWrites: " +
pendingRequests + " lastWrite: " + new Date(writeTime) + "session: " + session);
// Close the session and throw an exception
session.close();
throw new IOException("Closing session that seems to be stalled. Preventing OOM");
}
// Call next filter (everything is fine)
super.filterWrite(nextFilter, session, writeRequest);
}
示例2: doHandshake
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
private boolean doHandshake(String streamID, XMPPPacketReader reader) throws Exception {
String password = JiveGlobals.getXMLProperty("xmpp.password");
if (password == null) {
// No password was configued in the connection manager
Log.debug("CM - No password was found. Configure xmpp.password property");
return false;
}
MessageDigest digest;
// Create a message digest instance.
try {
digest = MessageDigest.getInstance("SHA");
}
catch (NoSuchAlgorithmException e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
return false;
}
digest.update(streamID.getBytes());
String key = StringUtils.encodeHex(digest.digest(password.getBytes()));
Log.debug("OS - Sent handshake to host: " + serverName + " id: " + streamID);
// Send handshake to server
StringBuilder sb = new StringBuilder();
sb.append("<handshake>").append(key).append("</handshake>");
connection.deliverRawText(sb.toString());
// Wait for the <handshake> response
Element proceed = reader.parseDocument().getRootElement();
if (proceed != null && proceed.getName().equals("handshake")) {
Log.debug("OS - Handshake was SUCCESSFUL with host: " + serverName + " id: " +
streamID);
return true;
}
Log.debug("OS - Handshake FAILED with host: " + serverName + " id: " + streamID);
return false;
}
示例3: append
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
@Override
protected void append(LoggingEvent event)
{
final Level l = event.getLevel();
final String message = (event.getMessage() != null ? event.getMessage().toString() : "");
Throwable throwable = null;
if (event.getThrowableInformation() != null)
{
throwable = event.getThrowableInformation().getThrowable();
}
switch (l.toInt())
{
case Priority.OFF_INT:
// Logging turned off - do nothing.
break;
case Priority.FATAL_INT:
case Priority.ERROR_INT:
Log.error(message, throwable);
break;
case Priority.WARN_INT:
Log.warn(message, throwable);
break;
case Priority.INFO_INT:
Log.info(message, throwable);
break;
default:
// DEBUG and below (trace, all)
Log.debug(message, throwable);
break;
}
}
示例4: initializePlugin
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
Log.info("ServerInfo - Starting plugin.");
Log.debug("ServerInfo - Starting plugin.");
pluginManager = manager;
sessionManager = SessionManager.getInstance();
String serverInfoPort = JiveGlobals.getProperty(SERVERINFOPORT, "4455");
userManager = UserManager.getInstance();
// Register as a component.
componentManager = ComponentManagerFactory.getComponentManager();
try {
componentManager.addComponent(serviceName, this);
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
PropertyEventDispatcher.addListener(this);
Log.info("ServerInfo - Starting bind on port " + serverInfoPort + ".");
Log.debug("ServerInfo - Starting bind on port " + serverInfoPort + ".");
ofd_srv.startServer();
}
示例5: destroyPlugin
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void destroyPlugin() {
Log.info("ServerInfo - Closing plugin.");
Log.debug("ServerInfo - Closing plugin.");
PropertyEventDispatcher.removeListener(this);
// Unregister component.
if (componentManager != null) {
try {
componentManager.removeComponent(serviceName);
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
}
serviceName = JiveGlobals.getProperty("plugin.serverinfo.serviceName", "");
componentManager = null;
userManager = null;
pluginManager = null;
sessionManager = null;
Log.info("ServerInfo - Closing thread.");
Log.debug("ServerInfo - Closing thread.");
clientConnect();
ServerInfoPlugin.NotExit=false;
ServerInfoPlugin.ofThread.stop();
Log.info("ServerInfo - Thread closed.");
Log.debug("ServerInfo - Thread closed.");
}
示例6: shutdown
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void shutdown() {
Log.info("ServerInfo - Shutdown thread.");
Log.debug("ServerInfo - Shutdown thread.");
clientConnect();
ServerInfoPlugin.NotExit=false;
ServerInfoPlugin.ofThread.stop();
Log.info("ServerInfo - Thread closed.");
Log.debug("ServerInfo - Thread closed.");
}
示例7: deliverRawText
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void deliverRawText(String text, boolean asynchronous) {
if (!isClosed()) {
ByteBuffer buffer = ByteBuffer.allocate(text.length());
buffer.setAutoExpand(true);
boolean errorDelivering = false;
try {
//Charset charset = Charset.forName(CHARSET);
//buffer.putString(text, charset.newEncoder());
buffer.put(text.getBytes(CHARSET));
if (flashClient) {
buffer.put((byte) '\0');
}
buffer.flip();
if (asynchronous) {
ioSession.write(buffer);
}
else {
// Send stanza and wait for ACK (using a 2 seconds default timeout)
boolean ok =
ioSession.write(buffer).join(JiveGlobals.getIntProperty("connection.ack.timeout", 2000));
if (!ok) {
Log.warn("No ACK was received when sending stanza to: " + this.toString());
}
}
}
catch (Exception e) {
Log.debug("Error delivering raw text" + "\n" + this.toString(), e);
errorDelivering = true;
}
if (errorDelivering) {
close();
}
}
}
示例8: initializePlugin
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
Log.info("B9 - Starting plugin.");
Log.debug("B9 - Starting plugin.");
pluginManager = manager;
sessionManager = SessionManager.getInstance();
userManager = UserManager.getInstance();
// Register as a component.
componentManager = ComponentManagerFactory.getComponentManager();
try {
componentManager.addComponent(serviceName, this);
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
PropertyEventDispatcher.addListener(this);
if (b9SocketEnabled) {
Log.info("B9 - Starting bind on port " + b9Port + ".");
Log.debug("B9 - Starting bind on port " + b9Port + ".");
b9d_srv.startServer();
}
}
示例9: append
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
@Override
protected void append(LoggingEvent event)
{
final Level l = event.getLevel();
final String message = (event.getMessage() != null ? event.getMessage().toString() : "");
Throwable throwable = null;
if (event.getThrowableInformation() != null)
{
throwable = event.getThrowableInformation().getThrowable();
}
switch (l.toInt())
{
case Priority.OFF_INT:
// Logging turned off - do nothing.
break;
case Priority.FATAL_INT:
case Priority.ERROR_INT:
Log.error(message, throwable);
break;
case Priority.WARN_INT:
Log.warn(message, throwable);
break;
case Priority.INFO_INT:
Log.info(message, throwable);
break;
default:
// DEBUG and below (trace, all)
Log.debug(message, throwable);
break;
}
}
示例10: shutdown
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void shutdown() {
Log.info("B9 - Shutdown thread.");
Log.debug("B9 - Shutdown thread.");
if (b9SocketEnabled) {
clientConnect();
B9Plugin.NotExit=false;
B9Plugin.ofThread.stop();
Log.info("B9 - Thread closed.");
Log.debug("B9 - Thread closed.");
}
}
示例11: deliverRawText
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void deliverRawText(String text) {
if (!isClosed()) {
boolean errorDelivering = false;
boolean allowedToWrite = false;
try {
requestWriting();
//System.out.println(new Date(System.currentTimeMillis()) + ", " + hashCode() + ", " + sent.incrementAndGet());
allowedToWrite = true;
// Register that we started sending data on the connection
writeStarted();
writer.write(text);
if (flashClient) {
writer.write('\0');
}
writer.flush();
}
catch (Exception e) {
Log.debug("Error delivering raw text" + "\n" + this.toString(), e);
errorDelivering = true;
}
finally {
// Register that we finished sending data on the connection
writeFinished();
if (allowedToWrite) {
releaseWriting();
}
}
if (errorDelivering) {
close();
}
}
}
示例12: verifyAuth
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public Integer verifyAuth(String message) {
String[] param = message.split(" ");
String b9Password = JiveGlobals.getProperty("plugin.b9.password", "Sd2E9hAvs9LBLcbDVtHsigoP8sAFx6FS");
Log.debug("B9 - Processing message received.");
Log.debug("B9 - Verifying user access.");
if (param[0].equals("login")) {
if (param.length < 2) {
//"You need to inform secret"
return 2;
}
else {
if (param[1].equals(b9Password)) {
//"You are now identified and can send commands"
return 0;
}
else {
//"Invalid secret"
return 3;
}
}
}
else {
//"First you need to identify yourself using commando: login <secret>"
return 1;
}
}
示例13: checkHealth
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
/**
* Returns true if the socket was closed due to a bad health. The socket is considered to
* be in a bad state if a thread has been writing for a while and the write operation has
* not finished in a long time or when the client has not sent a heartbeat for a long time.
* In any of both cases the socket will be closed.
*
* @return true if the socket was closed due to a bad health.s
*/
boolean checkHealth() {
// Check that the sending operation is still active
long writeTimestamp = writeStarted;
if (writeTimestamp > -1 && System.currentTimeMillis() - writeTimestamp >
JiveGlobals.getIntProperty("xmpp.session.sending-limit", 60000)) {
// Close the socket
if (Log.isDebugEnabled()) {
Log.debug("Closing connection: " + this + " that started sending data at: " +
new Date(writeTimestamp));
}
forceClose();
return true;
}
else {
// Check if the connection has been idle. A connection is considered idle if the client
// has not been receiving data for a period. Sending data to the client is not
// considered as activity.
if (idleTimeout > -1 && socketStatistic != null &&
System.currentTimeMillis() - socketStatistic.getLastActive() > idleTimeout) {
// Close the socket
if (Log.isDebugEnabled()) {
Log.debug("Closing connection that has been idle: " + this);
}
forceClose();
return true;
}
}
return false;
}
示例14: sessionIdle
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
@Override
public void sessionIdle(IoSession session, IdleStatus status) throws Exception {
// Get the connection for this session
Connection connection = (Connection) session.getAttribute(CONNECTION);
// Close idle connection
if (Log.isDebugEnabled()) {
Log.debug("Closing connection that has been idle: " + connection);
}
connection.close();
}
示例15: append
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
@Override
protected void append(LoggingEvent event)
{
final Level l = event.getLevel();
final String message = event.getMessage().toString();
Throwable throwable = null;
if (event.getThrowableInformation() != null)
{
throwable = event.getThrowableInformation().getThrowable();
}
switch (l.toInt())
{
case Priority.OFF_INT:
// Logging turned off - do nothing.
break;
case Priority.FATAL_INT:
case Priority.ERROR_INT:
Log.debug(message, throwable);
break;
case Priority.WARN_INT:
Log.debug(message, throwable);
break;
case Priority.INFO_INT:
Log.debug(message, throwable);
break;
default:
// DEBUG and below (trace, all)
Log.debug(message, throwable);
break;
}
}