Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

less verbose info-level logging #48032

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/connmgr/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use crate::future::{
};
use arrayvec::ArrayVec;
use ipnet::IpNet;
use log::{debug, error, info, warn};
use log::{debug, error, warn};
use mio::unix::SourceFd;
use slab::Slab;
use std::cell::Cell;
Expand Down Expand Up @@ -1763,7 +1763,7 @@ impl Client {
let pool = Arc::new(ConnectionPool::new(pool_max));

if !deny.is_empty() {
info!("default policy: block outgoing connections to {:?}", deny);
debug!("default policy: block outgoing connections to {:?}", deny);
}

let blocks_avail = Arc::new(Counter::new(blocks_max - (stream_maxconn * 2)));
Expand Down
22 changes: 11 additions & 11 deletions src/connmgr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use self::client::Client;
use self::server::{Server, MSG_RETAINED_PER_CONNECTION_MAX, MSG_RETAINED_PER_WORKER_MAX};
use crate::core::zmq::SpecInfo;
use ipnet::IpNet;
use log::info;
use log::{debug, info};
use signal_hook;
use signal_hook::consts::TERM_SIGNALS;
use signal_hook::iterator::Signals;
Expand Down Expand Up @@ -173,9 +173,9 @@ impl App {

for spec in config.zclient_req.iter() {
if config.zclient_connect {
info!("zhttp client connect {}", spec);
debug!("zhttp client connect {}", spec);
} else {
info!("zhttp client bind {}", spec);
debug!("zhttp client bind {}", spec);
}

specs.push(SpecInfo {
Expand All @@ -199,12 +199,12 @@ impl App {
let (out_spec, out_stream_spec, in_spec) = make_specs(spec, false)?;

if config.zclient_connect {
info!(
debug!(
"zhttp client connect {} {} {}",
out_spec, out_stream_spec, in_spec
);
} else {
info!(
debug!(
"zhttp client bind {} {} {}",
out_spec, out_stream_spec, in_spec
);
Expand Down Expand Up @@ -275,9 +275,9 @@ impl App {

for spec in config.zserver_req.iter() {
if config.zserver_connect {
info!("zhttp server connect {}", spec);
debug!("zhttp server connect {}", spec);
} else {
info!("zhttp server bind {}", spec);
debug!("zhttp server bind {}", spec);
}

specs.push(SpecInfo {
Expand Down Expand Up @@ -322,12 +322,12 @@ impl App {
let (in_spec, in_stream_spec, out_spec) = make_specs(spec, true)?;

if config.zserver_connect {
info!(
debug!(
"zhttp server connect {} {} {}",
in_spec, in_stream_spec, out_spec
);
} else {
info!(
debug!(
"zhttp server bind {} {} {}",
in_spec, in_stream_spec, out_spec
);
Expand Down Expand Up @@ -407,7 +407,7 @@ impl App {
}

pub fn run(config: &Config) -> Result<(), Box<dyn Error>> {
info!("starting...");
debug!("starting...");

{
let a = match App::new(config) {
Expand All @@ -424,7 +424,7 @@ pub fn run(config: &Config) -> Result<(), Box<dyn Error>> {
info!("stopping...");
}

info!("stopped");
debug!("stopped");

Ok(())
}
23 changes: 14 additions & 9 deletions src/core/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,20 @@ impl Log for SimpleLogger {
log::Level::Trace => "TRACE",
};

writeln!(
&mut output,
"[{}] {} [{}] {}",
lname,
ts,
record.target(),
record.args()
)
.expect("failed to write log output");
if record.level() <= log::Level::Info {
writeln!(&mut output, "[{}] {} {}", lname, ts, record.args())
.expect("failed to write log output");
} else {
writeln!(
&mut output,
"[{}] {} [{}] {}",
lname,
ts,
record.target(),
record.args()
)
.expect("failed to write log output");
}
}

fn flush(&self) {}
Expand Down
4 changes: 2 additions & 2 deletions src/handler/handlerapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class HandlerApp::Private : public QObject
}
}

log_info("starting...");
log_debug("starting...");

QString configFile = args.configFile;
if(configFile.isEmpty())
Expand Down Expand Up @@ -430,7 +430,7 @@ class HandlerApp::Private : public QObject
delete engine;
engine = 0;

log_info("stopped");
log_debug("stopped");
q->quit(0);
}
};
Expand Down
30 changes: 15 additions & 15 deletions src/handler/handlerengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,8 +1356,8 @@ class HandlerEngine::Private : public QObject
zhttpOut->setClientOutStreamSpecs(config.clientOutStreamSpecs);
zhttpOut->setClientInSpecs(config.clientInSpecs);

log_info("zhttp in stream: %s", qPrintable(config.serverInStreamSpecs.join(", ")));
log_info("zhttp out: %s", qPrintable(config.serverOutSpecs.join(", ")));
log_debug("zhttp in stream: %s", qPrintable(config.serverInStreamSpecs.join(", ")));
log_debug("zhttp out: %s", qPrintable(config.serverOutSpecs.join(", ")));

if(!config.inspectSpecs.isEmpty())
{
Expand All @@ -1372,7 +1372,7 @@ class HandlerEngine::Private : public QObject
return false;
}

log_info("inspect server: %s", qPrintable(config.inspectSpecs.join(", ")));
log_debug("inspect server: %s", qPrintable(config.inspectSpecs.join(", ")));
}

if(!config.acceptSpecs.isEmpty())
Expand All @@ -1388,7 +1388,7 @@ class HandlerEngine::Private : public QObject
return false;
}

log_info("accept server: %s", qPrintable(config.acceptSpecs.join(", ")));
log_debug("accept server: %s", qPrintable(config.acceptSpecs.join(", ")));
}

if(!config.stateSpec.isEmpty())
Expand All @@ -1404,7 +1404,7 @@ class HandlerEngine::Private : public QObject
return false;
}

log_info("state client: %s", qPrintable(config.stateSpec));
log_debug("state client: %s", qPrintable(config.stateSpec));
}

if(!config.commandSpec.isEmpty())
Expand All @@ -1420,7 +1420,7 @@ class HandlerEngine::Private : public QObject
return false;
}

log_info("control server: %s", qPrintable(config.commandSpec));
log_debug("control server: %s", qPrintable(config.commandSpec));
}

if(!config.pushInSpec.isEmpty())
Expand All @@ -1438,7 +1438,7 @@ class HandlerEngine::Private : public QObject
inPullValve = new QZmq::Valve(inPullSock, this);
pullConnection = inPullValve->readyRead.connect(boost::bind(&Private::inPull_readyRead, this, boost::placeholders::_1));

log_info("in pull: %s", qPrintable(config.pushInSpec));
log_debug("in pull: %s", qPrintable(config.pushInSpec));
}

if(!config.pushInSubSpecs.isEmpty())
Expand All @@ -1465,7 +1465,7 @@ class HandlerEngine::Private : public QObject
inSubValve = new QZmq::Valve(inSubSock, this);
inSubValveConnection = inSubValve->readyRead.connect(boost::bind(&Private::inSub_readyRead, this, boost::placeholders::_1));

log_info("in sub: %s", qPrintable(config.pushInSubSpecs.join(", ")));
log_debug("in sub: %s", qPrintable(config.pushInSubSpecs.join(", ")));
}

if(!config.retryOutSpecs.isEmpty())
Expand All @@ -1486,7 +1486,7 @@ class HandlerEngine::Private : public QObject
}
}

log_info("retry: %s", qPrintable(config.retryOutSpecs.join(", ")));
log_debug("retry: %s", qPrintable(config.retryOutSpecs.join(", ")));
}

if(!config.wsControlInitSpecs.isEmpty() && !config.wsControlStreamSpecs.isEmpty())
Expand All @@ -1507,7 +1507,7 @@ class HandlerEngine::Private : public QObject
wsControlInitValve = new QZmq::Valve(wsControlInitSock, this);
controlInitValveConnection = wsControlInitValve->readyRead.connect(boost::bind(&Private::wsControlInit_readyRead, this, boost::placeholders::_1));

log_info("ws control init: %s", qPrintable(config.wsControlInitSpecs.join(", ")));
log_debug("ws control init: %s", qPrintable(config.wsControlInitSpecs.join(", ")));

wsControlStreamSock = new QZmq::Socket(QZmq::Socket::Router, this);
wsControlStreamSock->setIdentity(config.instanceId);
Expand All @@ -1528,7 +1528,7 @@ class HandlerEngine::Private : public QObject
wsControlStreamValve = new QZmq::Valve(wsControlStreamSock, this);
controlStreamValveConnection = wsControlStreamValve->readyRead.connect(boost::bind(&Private::wsControlStream_readyRead, this, boost::placeholders::_1));

log_info("ws control stream: %s", qPrintable(config.wsControlStreamSpecs.join(", ")));
log_debug("ws control stream: %s", qPrintable(config.wsControlStreamSpecs.join(", ")));
}

stats = new StatsManager(config.connectionsMax, config.connectionsMax * config.connectionSubscriptionMax, this);
Expand Down Expand Up @@ -1562,7 +1562,7 @@ class HandlerEngine::Private : public QObject
return false;
}

log_info("stats: %s", qPrintable(config.statsSpec));
log_debug("stats: %s", qPrintable(config.statsSpec));
}

if(!config.prometheusPort.isEmpty())
Expand Down Expand Up @@ -1596,7 +1596,7 @@ class HandlerEngine::Private : public QObject
proxyStatsValve = new QZmq::Valve(proxyStatsSock, this);
proxyStatConnection = proxyStatsValve->readyRead.connect(boost::bind(&Private::proxyStats_readyRead, this, boost::placeholders::_1));

log_info("proxy stats: %s", qPrintable(config.proxyStatsSpecs.join(", ")));
log_debug("proxy stats: %s", qPrintable(config.proxyStatsSpecs.join(", ")));
}

if(!config.proxyCommandSpec.isEmpty())
Expand All @@ -1611,7 +1611,7 @@ class HandlerEngine::Private : public QObject
return false;
}

log_info("proxy control client: %s", qPrintable(config.proxyCommandSpec));
log_debug("proxy control client: %s", qPrintable(config.proxyCommandSpec));
}

if(config.pushInHttpPort != -1)
Expand Down Expand Up @@ -1761,7 +1761,7 @@ class HandlerEngine::Private : public QObject
if(items > -1)
msg += QString(" items=%1").arg(items);

log_info("%s", qPrintable(msg));
log_debug("%s", qPrintable(msg));
}

void publishSend(QObject *target, const PublishItem &item, const QList<QByteArray> &exposeHeaders)
Expand Down
4 changes: 2 additions & 2 deletions src/proxy/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class App::Private : public QObject
}
}

log_info("starting...");
log_debug("starting...");

QString configFile = args.configFile;
if(configFile.isEmpty())
Expand Down Expand Up @@ -694,7 +694,7 @@ private slots:

threads.clear();

log_info("stopped");
log_debug("stopped");
q->quit(0);
}
};
Expand Down
14 changes: 10 additions & 4 deletions src/runner/runnerapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ class RunnerApp::Private
}
}

log_info("starting...");

QStringList configFileList;

if(!args.configFile.isEmpty())
Expand Down Expand Up @@ -364,6 +362,11 @@ class RunnerApp::Private
}
}

int defaultArgsLevel = args.logLevels.value("", LOG_LEVEL_INFO);
log_setOutputLevel(args.logLevels.value("runner", defaultArgsLevel));

log_debug("starting...");

if(args.configFile.isEmpty())
log_info("using config: %s", qPrintable(configFile));

Expand Down Expand Up @@ -728,7 +731,7 @@ class RunnerApp::Private
{
if(services.isEmpty())
{
log_info("stopped");
log_debug("stopped");
doQuit();
}
}
Expand All @@ -751,7 +754,7 @@ class RunnerApp::Private
}

if(allStarted)
log_info("started");
log_debug("started");
}

void service_stopped(Service *s)
Expand Down Expand Up @@ -811,6 +814,9 @@ class RunnerApp::Private
{
if(!stopping)
{
// let a potential "^C" get overwritten
printf("\r");

stopping = true;
ProcessQuit::reset(); // allow user to quit again

Expand Down
3 changes: 3 additions & 0 deletions src/runner/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ pub fn start_services(mut settings: Settings) {
break;
}
Ok(Err(ServiceError::TermSignal(error_message))) => {
// let a potential "^C" get overwritten
print!("\r");

error!("signal received: {}", error_message);
break;
}
Expand Down
Loading