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

Use Log output instead of standard out #62

Merged
merged 1 commit into from
Mar 25, 2025
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
13 changes: 7 additions & 6 deletions src/multio/config/MultioConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

#include "multio/config/MetadataMappings.h"
#include "multio/config/MultioConfiguration.h"

#include "eckit/log/Log.h"
#include "multio/LibMultio.h"
#include "multio/util/Environment.h"
#include "multio/util/Substitution.h"

Expand Down Expand Up @@ -61,14 +62,14 @@ ConfigAndPaths configureFromEnv(config::LocalPeerTag tag) {

if (::getenv("MULTIO_PLANS")) {
std::string cfg(::getenv("MULTIO_PLANS"));
std::cout << "MultIO initialising with plans " << cfg << std::endl;
LOG_DEBUG_LIB(LibMultio) << "MultIO initialising with plans " << cfg << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to use eckit::Log::info(), no? I think there is no harm printing this all the time as the output is fairly limited.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should consider printing this only from one server

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of only printing it from one server. This would be another reason to have this IO-Server "Master".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to use eckit::Log::info(), no? I think there is no harm printing this all the time as the output is fairly limited.

Well for smaller runs it is limited but if they run larger production runs it does get more annoying. The information in general is useful, we probably just don't want to have it printed so often.

Essentially this is a non urgent, "make it look prettier", idea, to reduce log messages that can't be turned off. The output scripts are annoying to search through as it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I can just merge this and see how much it is missed. Then we can come up with a cleverer solution.

paths.configDir = "";
return ConfigAndPaths{paths, eckit::LocalConfiguration{eckit::YAMLConfiguration(cfg)}};
}

if (::getenv("MULTIO_PLANS_FILE")) {
eckit::PathName filePath(::getenv("MULTIO_PLANS_FILE"));
std::cout << "MultIO initialising with plans file " << filePath << std::endl;
LOG_DEBUG_LIB(LibMultio) << "MultIO initialising with plans file " << filePath << std::endl;

auto paths2 = defaultConfigPaths(filePath);
return ConfigAndPaths{paths2, eckit::LocalConfiguration{eckit::YAMLConfiguration{paths2.configDir}}};
Expand All @@ -77,14 +78,14 @@ ConfigAndPaths configureFromEnv(config::LocalPeerTag tag) {
// IFS Legacy
if (::getenv("MULTIO_CONFIG")) {
std::string cfg(::getenv("MULTIO_CONFIG"));
std::cout << "MultIO initialising with config " << cfg << std::endl;
LOG_DEBUG_LIB(LibMultio) << "MultIO initialising with config " << cfg << std::endl;
paths.configDir = "";
return ConfigAndPaths{paths, configureFromSinks(eckit::LocalConfiguration{eckit::YAMLConfiguration(cfg)})};
}

if (::getenv("MULTIO_CONFIG_FILE")) {
eckit::PathName filePath(::getenv("MULTIO_CONFIG_FILE"));
std::cout << "MultIO initialising with config file " << filePath << std::endl;
LOG_DEBUG_LIB(LibMultio) << "MultIO initialising with config file " << filePath << std::endl;

auto paths2 = defaultConfigPaths(filePath);
return ConfigAndPaths{
Expand All @@ -110,7 +111,7 @@ ConfigAndPaths configureFromEnv(config::LocalPeerTag tag) {
}
oss << "] }";

std::cout << "MultIO initialising with $MULTIO_SINKS " << oss.str() << std::endl;
LOG_DEBUG_LIB(multio::LibMultio) << "MultIO initialising with $MULTIO_SINKS " << oss.str() << std::endl;

std::istringstream iss(oss.str());
paths.configDir = "";
Expand Down
10 changes: 6 additions & 4 deletions src/multio/ifsio/ifsio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "eckit/config/YAMLConfiguration.h"
#include "eckit/exception/Exceptions.h"
#include "eckit/filesystem/PathName.h"
#include "eckit/log/Log.h"
#include "eckit/message/Message.h"
#include "eckit/runtime/Main.h"
#include "eckit/thread/AutoLock.h"
Expand All @@ -34,6 +35,7 @@
#include "multio/multio_version.h"
#include "multio/util/FailureHandling.h"
// #include "multio/action/Sink.h"

#include "multio/LibMultio.h"

#include "metkit/codes/CodesContent.h"
Expand Down Expand Up @@ -146,28 +148,28 @@ class MIO : public config::MultioConfigurationHolder, public util::FailureAware<

if (::getenv("MULTIO_PLANS")) {
std::string cfg(::getenv("MULTIO_PLANS"));
std::cout << "MultIO initialising with plans " << cfg << std::endl;
LOG_DEBUG_LIB(LibMultio) << "MultIO initialising with plans " << cfg << std::endl;
eckit::LocalConfiguration conf{eckit::YAMLConfiguration(cfg)};
return std::make_tuple(conf, MultioConfiguration(conf, config::LocalPeerTag::Client));
}

if (::getenv("MULTIO_PLANS_FILE")) {
PathName path(::getenv("MULTIO_PLANS_FILE"));
std::cout << "MultIO initialising with plans file " << path << std::endl;
LOG_DEBUG_LIB(LibMultio) << "MultIO initialising with plans file " << path << std::endl;
MultioConfiguration multioConf(path, config::LocalPeerTag::Client);
return std::make_tuple(multioConf.parsedConfig(), std::move(multioConf));
}

if (::getenv("MULTIO_CONFIG")) {
std::string cfg(::getenv("MULTIO_CONFIG"));
std::cout << "MultIO initialising with config " << cfg << std::endl;
LOG_DEBUG_LIB(LibMultio) << "MultIO initialising with config " << cfg << std::endl;
return configureFromSinks(MultioConfiguration(eckit::LocalConfiguration(eckit::YAMLConfiguration(cfg)),
config::LocalPeerTag::Client));
}

if (::getenv("MULTIO_CONFIG_FILE")) {
PathName filePath(::getenv("MULTIO_CONFIG_FILE"));
std::cout << "MultIO initialising with config file " << filePath << std::endl;
LOG_DEBUG_LIB(LibMultio) << "MultIO initialising with config file " << filePath << std::endl;
return configureFromSinks(MultioConfiguration(filePath, config::LocalPeerTag::Client));
}

Expand Down
Loading