How to reduce the log level of the lora server

Hello,

Is it possible to reduce the log level of the LoRa server?
Can’t find an environment variable to do so.

I am running it in Docker and after running for some hours the container hangs so I want to reduce the log level to solve this issue.

Thanks and best regards!

I think it’s not available right now, but it should be fairly easy to add. All you need to do is add a flag and then set the logger’s level, like this:

func setLogLevel(c *cli.Context) error {
	log.SetLevel(log.Level(uint8(c.Int("log-level"))))
	return nil
}
...
cli.IntFlag{
	Name:   "log-level",
	Value:  5,
	Usage:  "debug=5, info=4, warning=3, error=2, fatal=1, panic=0",
	EnvVar: "LOG_LEVEL",
},

Finally, add it to tasks:

tasks := []func(*cli.Context) error{
    setLogLevel,
	setNetID,
	setBandConfig,
	setDeduplicationDelay,
	setGetDownlinkDataDelay,
	setCreateGatewayOnStats,
	setNodeSessionTTL,
	setLogNodeFrames,
	setGatewayServerJWTSecret,
	setStatsAggregationIntervals,
	setTimezone,
	printStartMessage,
	enableUplinkChannels,
	setRedisPool,
	setPostgreSQLConnection,
	setGatewayBackend,
	setApplicationServer,
	setNetworkController,
	runDatabaseMigrations,
	startAPIServer,
	startGatewayAPIServer,
	startLoRaServer(server),
	startStatsServer(gwStats),
}

Unless there’s a reason why this is not implemented, I’ll fork current loraserver and make a PR with this feature.

1 Like

That would be much appreciated :+1:

1 Like

I implemented it and made a PR already. :wink:

1 Like

@iegomez: Great! thanks!
@brocaar: when the PR will be available on the latest docker image so I can use it? thanks!

Thanks @iegomez :slight_smile: I’ve just merged the pull-request. An updated Docker container should be available in a couple of minutes.

1 Like