Azure / azure-storage-cpp

Microsoft Azure Storage Client Library for C++
http://azure.github.io/azure-storage-cpp
Apache License 2.0
132 stars 147 forks source link

How to enable logging on linux? #361

Open niteenk opened 4 years ago

niteenk commented 4 years ago

I have 3 questions around logging:

  1. What is location of logs? can we provide custom location ? if yes how?
  2. I tried 2 things but nothing worked for me <<1>> azure::storage::operation_context* m_context = new azure::storage::operation_context(); m_context->set_log_level(azure::storage::client_log_level::log_level_verbose);

<<2>> void init() { boost::log::add_file_log ( boost::log::keywords::file_name = "boost.log", /< file name pattern >/ boost::log::keywords::rotation_size = 10 1024 1024, /< rotate files every 10 MiB... >/ boost::log::keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point(0, 0, 0), /< ...or at midnight >/ boost::log::keywords::format = "[%TimeStamp%]: %Message%", /< log record format >/ boost::log::keywords::target = "/tmp", boost::log::keywords::auto_flush = true, boost::log::keywords::open_mode = std::ios_base::app | std::ios_base::out );

boost::log::core::get()->set_filter
(
 boost::log::trivial::severity >= 0
 );

}

int main() { inti(); boost::log::add_common_attributes(); boost::log::sources::severity_logger lg; m_context->set_logger(lg);

// perform operations like list blob, download page ranges etc. }

  1. if I enable logging for azure-storage-cpp does it alsoo applicable to cpprest or I have enable cpprest logging separately ?

thanks, Niteen

Jinming-Hu commented 4 years ago

@katmsft Do you know about logging in this SDK?

katmsft commented 4 years ago

https://github.com/Azure/azure-storage-cpp/issues/168 you can reference this issue.