2008-08-21 07:38:43 +02:00
|
|
|
/*
|
2012-06-04 22:35:22 +02:00
|
|
|
* Copyright 2012 The Netty Project
|
2008-08-21 07:38:43 +02:00
|
|
|
*
|
2011-12-09 06:16:33 +01:00
|
|
|
* The Netty Project licenses this file to you under the Apache License,
|
|
|
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at:
|
2008-08-21 07:38:43 +02:00
|
|
|
*
|
2012-06-04 22:35:22 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2008-08-21 07:38:43 +02:00
|
|
|
*
|
2009-08-28 09:15:49 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
2011-12-09 06:16:33 +01:00
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
2009-08-28 09:15:49 +02:00
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2008-08-21 07:38:43 +02:00
|
|
|
*/
|
|
|
|
package org.jboss.netty.util;
|
2009-04-03 09:41:54 +02:00
|
|
|
|
2009-06-17 07:28:53 +02:00
|
|
|
import org.jboss.netty.channel.ChannelPipeline;
|
|
|
|
import org.jboss.netty.channel.ChannelSink;
|
2009-04-03 09:41:54 +02:00
|
|
|
import org.jboss.netty.util.internal.SystemPropertyUtil;
|
2008-08-21 07:38:43 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determines if Netty is running in a debug mode or not. Please note that
|
|
|
|
* this is not a Java debug mode. You can enable Netty debug mode by
|
|
|
|
* specifying the {@code "org.jboss.netty.debug"} system property (e.g.
|
|
|
|
* {@code java -Dorg.jboss.netty.debug ...})
|
2009-06-17 07:28:53 +02:00
|
|
|
* <p>
|
|
|
|
* If debug mode is disabled (default), the stack trace of the exceptions are
|
|
|
|
* compressed to help debugging a user application.
|
|
|
|
* <p>
|
|
|
|
* If debug mode is enabled, the stack trace of the exceptions raised in
|
|
|
|
* {@link ChannelPipeline} or {@link ChannelSink} are retained as it is to help
|
|
|
|
* debugging Netty.
|
2008-08-21 07:38:43 +02:00
|
|
|
*/
|
2012-01-11 12:17:47 +01:00
|
|
|
public final class DebugUtil {
|
2008-08-21 07:38:43 +02:00
|
|
|
|
2012-09-01 09:49:22 +02:00
|
|
|
private static final boolean DEBUG_ENABLED =
|
|
|
|
SystemPropertyUtil.getBoolean("org.jboss.netty.debug", false);
|
|
|
|
|
2008-08-21 07:38:43 +02:00
|
|
|
/**
|
|
|
|
* Returns {@code true} if and only if Netty debug mode is enabled.
|
|
|
|
*/
|
|
|
|
public static boolean isDebugEnabled() {
|
2012-09-01 09:49:22 +02:00
|
|
|
return DEBUG_ENABLED;
|
2008-08-21 07:38:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private DebugUtil() {
|
|
|
|
// Unused
|
|
|
|
}
|
|
|
|
}
|