ztkmkoo / dss

Asynchronous distributed server system (dss)
MIT License
19 stars 13 forks source link

Set netty and akka log level from service level #80

Closed ztkmkoo closed 4 years ago

ztkmkoo commented 4 years ago

See io.github.ztkmkoo.dss.core.network.rest.DssRestChannel

public class DssRestChannel {
    public DssRestChannel() {
    }

    public Channel bind(ServerBootstrap serverBootstrap, DssRestChannelProperty dssRestChannelProperty, DssRestChannelInitializer dssRestChannelInitializer) throws InterruptedException {
        Objects.requireNonNull(serverBootstrap);
        Objects.requireNonNull(dssRestChannelProperty);
        Objects.requireNonNull(dssRestChannelInitializer);
        return ((ServerBootstrap)((ServerBootstrap)serverBootstrap.channel(NioServerSocketChannel.class)).handler(new LoggingHandler(LogLevel.DEBUG))).childHandler(dssRestChannelInitializer).bind(dssRestChannelProperty.getHost(), dssRestChannelProperty.getPort()).sync().channel();
    }
}

It config netty loglevel default as debug level. By the way, i can config the log level in the service project with create new logback.xml file(so we can see thenetty debug log), but it is necessary to make config log level possible.

How bout implementing a new log level enumeration mapping netty log level(io.netty.handler.logging.LogLevel) and let's pass the parameter to DssRestServer constructure.

vincentj2 commented 4 years ago

@vincentj2

vincentj2 commented 4 years ago

Can you give me some advice? I have to create a new logback.xml file or just modify an extisting one?

ztkmkoo commented 4 years ago

@vincentj2 the logback.xml would be overwrote when final user create the logback file in their project.

I think, we could set the loglevel in DssRestServer.

So,