Java 类io.netty.util.internal.logging.InternalLogger 实例源码

项目:yajsw    文件:ScriptFactory.java   
/**
 * Creates a new Script object.
 * 
 * @param script
 *            the script
 * @param timeout
 * 
 * @return the script
 */
public static Script createScript(String script, String id,
        WrappedProcess process, String[] args, InternalLogger log,
        int timeout, String encoding, boolean reload, int debug,
        int maxConcInvocations)
{
    if (script == null || "".equals(script))
        return null;
    if (log != null && debug > 1)
        log.info("create script: " + script);
    if (script.endsWith(".bat") || script.endsWith(".sh"))
        return new ShellScript(script, id, process, args, timeout,
                maxConcInvocations);
    if (script.endsWith(".gv") || script.endsWith(".groovy"))
        try
        {
            return new GroovyScript(script, id, process, args, timeout,
                    log, encoding, reload, maxConcInvocations);
        }
        catch (Throwable e)
        {
            if (log != null)
                log.info("Error in createScript " + script, e);
        }
    return null;
}
项目:yajsw    文件:GroovyScript.java   
/**
 * Instantiates a new groovy script.
 * 
 * @param script
 *            the script
 * @param timeout
 * @throws IOException
 * @throws CompilationFailedException
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
public GroovyScript(final String script, final String id,
        final WrappedProcess process, final String[] args,
        final int timeout, final InternalLogger logger, String encoding,
        boolean reload, int maxConcInvocations)
        throws CompilationFailedException, IOException,
        InstantiationException, IllegalAccessException,
        ClassNotFoundException
{
    super(script, id, process, args, timeout, maxConcInvocations);
    _reload = reload;
    _encoding = encoding;

    // let's call some method on an instance
    _script = getScriptInstance(script, encoding);
    binding = (Binding) _script.invokeMethod("getBinding", null);
    binding.setVariable("args", args);
    binding.setVariable("callCount", 0);
    binding.setVariable("context", context);
    if (process != null && logger == null)
        _logger = process.getInternalWrapperLogger();
    else
        _logger = logger;
    binding.setVariable("logger", _logger);
}
项目:yajsw    文件:AHessianJmxClient.java   
public AHessianJmxClient(String discoveryName, int port, boolean debug,
        InternalLogger logger) throws Exception
{
    _discoveryName = discoveryName;
    _port = port;
    _debug = debug;
    _logger = logger;
    Map options = new HashMap();
    options.put("sync", true);
    options.put("timeout", (long) 5000);

    final ChannelPipelineFactoryBuilder<MBeanServerConnection> builder = new ChannelPipelineFactoryBuilder<MBeanServerConnection>()
            .serviceThreads(10).reconnect(10)
            .rpcServiceInterface(MBeanServerConnection.class)
            .serviceOptions(options);

    builder.debug();
    builder.serializerFactory(new JmxSerializerFactory());

    final Set<String> channelOptions = new HashSet();
    channelOptions.add("SO_REUSE");
    channelOptions.add("TCP_NODELAY");
    client = new DefaultClient<MBeanServerConnection>(
            OioSocketChannel.class, builder, channelOptions);

}
项目:yajsw    文件:MetaClassHelper.java   
public static void logMethodCall(Object object, String methodName, Object[] arguments) {
    String className = getClassName(object);
    String logname = "methodCalls." + className + "." + methodName;
    InternalLogger objLog = InternalLoggerFactory.getInstance(logname);
    if (!objLog.isTraceEnabled()) return;
    StringBuilder msg = new StringBuilder(methodName);
    msg.append("(");
    if (arguments != null) {
        for (int i = 0; i < arguments.length;) {
            msg.append(normalizedValue(arguments[i]));
            if (++i < arguments.length) {
                msg.append(",");
            }
        }
    }
    msg.append(")");
    objLog.log(InternalLogLevel.TRACE, className, msg.toString(), "called from MetaClass.invokeMethod");
}
项目:SecureSmartHome    文件:Server.java   
/**
 * Init timeouts and the connection registry and start the netty IO server synchronously
 */
@Override
public void init(Container container) {
    super.init(container);
    try {
        // Configure netty
        InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory() {
            @Override
            public InternalLogger newInstance(String name) {
                return new NettyInternalLogger(name);
            }
        });
        ResourceLeakDetector.setLevel(CoreConstants.NettyConstants.RESOURCE_LEAK_DETECTION);
        // Start server
        startServer();
    } catch (InterruptedException e) {
        throw new StartupException("Could not start netty server", e);
    }
}
项目:SecureSmartHome    文件:Client.java   
/**
 * Configure netty and initialize related Components.
 * Afterwards call {@link #initClient()} method to start the netty IO client asynchronously.
 */
@Override
public void init(Container container) {
    super.init(container);
    // Configure netty
    InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory() {
        @Override
        public InternalLogger newInstance(String name) {
            return new NettyInternalLogger(name);
        }
    });
    ResourceLeakDetector.setLevel(CoreConstants.NettyConstants.RESOURCE_LEAK_DETECTION);
    // And try to connect
    isActive = true;
    initClient();
    // register BroadcastListener
    IntentFilter filter = new IntentFilter();
    filter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
    filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
    filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    requireComponent(ContainerService.KEY_CONTEXT).registerReceiver(broadcastReceiver, filter);
}
项目:lettuce-core    文件:DefaultCommandLatencyCollector.java   
public void retain() {

            if (counter.incrementAndGet() == 1) {

                if (instanceCounter.getAndIncrement() > 0) {
                    InternalLogger instance = InternalLoggerFactory.getInstance(getClass());
                    instance.info("Initialized PauseDetectorWrapper more than once.");
                }

                pauseDetector = new SimplePauseDetector(TimeUnit.MILLISECONDS.toNanos(10), TimeUnit.MILLISECONDS.toNanos(10), 3);
                Runtime.getRuntime().addShutdownHook(new Thread("ShutdownHook for SimplePauseDetector") {
                    @Override
                    public void run() {
                        if (pauseDetector != null) {
                            pauseDetector.shutdown();
                        }
                    }
                });
            }
        }
项目:yajsw    文件:ScriptFactory.java   
public static Script createScript(String script, String id,
        WrappedProcess process, List args, InternalLogger log, int timeout,
        String encoding, boolean reload, int debug, int maxConcInvocations)
{
    String[] argsArr = new String[0];
    if (args != null && args.size() > 0)
    {
        argsArr = new String[args.size()];
        for (int i = 0; i < argsArr.length; i++)
            argsArr[i] = args.get(i).toString();
    }
    return createScript(script, id, process, argsArr, log, timeout,
            encoding, reload, debug, maxConcInvocations);
}
项目:yajsw    文件:AhessianLogging.java   
public static void setAhessianLogger(final Logger log)
{
    InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory()
    {

        @Override
        public InternalLogger newInstance(String name)
        {
            return (InternalLogger) new JdkLogger(log, "ahessian-jmx");
        }
    });
}
项目:yajsw    文件:Condition.java   
public Condition(YajswConfigurationImpl config,
        WrappedProcess wrappedProcess, InternalLogger log)
{
    _config = config;
    _wp = wrappedProcess;
    _log = log;
}
项目:tesora-dve-pub    文件:NettyLeakIntercept.java   
public static LeakCounter installLeakTrap(){
    try {
        Field loggerField = ResourceLeakDetector.class.getDeclaredField("logger");
        loggerField.setAccessible(true);

        Field modifiersField = Field.class.getDeclaredField("modifiers");
        modifiersField.setAccessible(true);
        modifiersField.setInt(loggerField, loggerField.getModifiers() & ~Modifier.FINAL);

        InternalLogger leakLogger = (InternalLogger)loggerField.get(null);
        if (leakLogger instanceof LeakCounter) {
            logger.debug("leak counter already installed.");
            return (LeakCounter) leakLogger;
        }else if (leakLogger != null){
            logger.debug("monkeypatching leak counter into Netty leak detection.");
            LeakTrap trap = new LeakTrap(leakLogger);
            loggerField.set(null, trap);
            return trap;
        } else {
            throw new NullPointerException("Netty ResourceLeakDetector had null logger reference?");
        }
    } catch (Throwable t){
        t.printStackTrace();
        logger.warn("Couldn't monkeypatch leak counter into netty leak detection, returning noop counter to tests.");
        return new NoopLeakTrap();
    }
}
项目:elasticsearch_my    文件:Netty4Utils.java   
@Override
public InternalLogger newInstance(final String name) {
    return new Netty4InternalESLogger(name);
}
项目:util4j    文件:NetLogFactory.java   
public static InternalLogger getLogger(Class<?> c)
{
    return InternalLoggerFactory.getInstance(c);
}
项目:yajsw    文件:MulticastEndpoint.java   
public void setLogger(InternalLogger logger)
{
    this.logger = logger;
}
项目:yajsw    文件:PosixJavaHome.java   
public void setLogger(InternalLogger logger, int debug)
{
    _logger = logger;
    _debug = debug;
}
项目:yajsw    文件:WindowsJavaHome.java   
public void setLogger(InternalLogger logger, int debug)
{
    _logger = logger;
    _debug = debug;
}
项目:yajsw    文件:AHessianJmxServer.java   
public AHessianJmxServer(MBeanServer mbeanServer, String ipFilter,
        String serviceDiscoveryName, int port, InternalLogger logger,
        int debug, InetAddress address) throws Exception
{

    // InternalLoggerFactory.setDefaultFactory(new SimpleLoggerFactory());

    ChannelPipelineFactoryBuilder builder = new ChannelPipelineFactoryBuilder()
            .serializerFactory(new JmxSerializerFactory())
            .rpcServiceInterface(MBeanServerConnection.class)
            .rpcServerService(mbeanServer).serviceThreads(10)
            .ipFilter(ipFilter);

    if (debug > 2)
        builder.debug();

    Set<String> channelOptions = new HashSet();
    // channelOptions.add("SO_REUSE");
    channelOptions.add("TCP_NODELAY");

    int serverPort = port;

    DefaultServer server = new DefaultServer(OioServerSocketChannel.class,
            builder, channelOptions, serverPort, address);

    server.start();
    Channel channel = server.getChannel();

    Executor executor = Executors.newCachedThreadPool();

    if (serverPort == 0)
        serverPort = ((InetSocketAddress) channel.localAddress()).getPort();

    if (debug > 2 && logger != null)
        logger.info("ahessian jmx service bound to port " + serverPort);

    DiscoveryServer discovery = new DiscoveryServer();
    discovery.setDebug(debug > 2);
    discovery.setLogger(logger);
    // allow discovery only from localhost. other computers will be ignored
    discovery.setIpSet(new IpFilterRuleList("+n:localhost, -n:*"));
    discovery.setName(serviceDiscoveryName);
    discovery.setPort(serverPort);
    discovery.init();

}
项目:yajsw    文件:AbstractWrappedProcess.java   
public InternalLogger getInternalWrapperLogger()
{
    if (_internalLoggerFactory == null)
        _internalLoggerFactory = new JdkLogger2Factory(getWrapperLogger());
    return _internalLoggerFactory.newInstance("");
}
项目:yajsw    文件:CommonsLoggingAdapter.java   
public CommonsLoggingAdapter(InternalLogger log)
{
    _log = log;
}
项目:yajsw    文件:VFSUtils.java   
public static void setLogger(InternalLogger logger)
{
    fsManager.setLogger(new CommonsLoggingAdapter(logger));
}
项目:yajsw    文件:ConfigurationLoggingAdapter.java   
public ConfigurationLoggingAdapter(final InternalLogger log)
{
    _log = log;
}
项目:yajsw    文件:ConfigurationLoggingAdapter.java   
private InternalLogger getILog()
{
    return _log;
}
项目:dubbo3    文件:NettyHelper.java   
@Override
public InternalLogger newInstance(String name) {
    return new DubboLogger(LoggerFactory.getLogger(name));
}
项目:SlackDiscordBridge    文件:NettyLoggerFactory.java   
@Override
protected InternalLogger newInstance(final String name)
{
    return new NettyLog4j2Logger(logger);
}
项目:light-task-scheduler    文件:NettyLogger.java   
@Override
protected InternalLogger newInstance(String name) {
    return new LtsLogger(name);
}
项目:Kvantum    文件:NettyLoggerFactory.java   
@Override
protected InternalLogger newInstance(final String name)
{
    return NettyLogger.instance;
}
项目:Thor    文件:NettyHelper.java   
@Override
public InternalLogger newInstance(String name) {
    return new DubboLogger(LoggerFactory.getLogger(name));
}
项目:dubbo-ex    文件:NettyHelper.java   
@Override
public InternalLogger newInstance(String name) {
    return new DubboLogger(LoggerFactory.getLogger(name));
}
项目:dubbo-remoting-netty4    文件:NettyHelper.java   
@Override
public InternalLogger newInstance(String name) {
    return new DubboLogger(LoggerFactory.getLogger(name));
}
项目:dubbo2.js    文件:NettyHelper.java   
@Override
public InternalLogger newInstance(String name) {
    return new DubboLogger(LoggerFactory.getLogger(name));
}
项目:tesora-dve-pub    文件:NettyLeakIntercept.java   
public LeakTrap(InternalLogger delegate) {
    this.delegate = delegate;
}
项目:divconq    文件:LoggerFactory.java   
@Override
protected InternalLogger newInstance(String arg0) {
    return LoggerFactory.instance;
}
项目:dnd    文件:Log4j2LoggerFactory.java   
@Override
protected InternalLogger newInstance(final String name) {
    return new Log4j2Logger(LogManager.getLogger(name));
}
项目:yajsw    文件:JavaHome.java   
void setLogger(InternalLogger logger, int level);
项目:yajsw    文件:WrappedProcess.java   
public InternalLogger getInternalWrapperLogger();