We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
测试代码如下: int main() { hardcode::naruto::LogConfig log_config; hardcode::naruto::Logger::setGlobalConfig(log_config); hardcode::naruto::Logger::getLogger()->addAppender( "asyncfile", hardcode::naruto::LogAppenderInterface::Ptr(new hardcode::naruto::AsyncFileAppender("./lg/"))); const int32_t count = 10; std::string tmp("testssss"); auto start = std::chrono::system_clock::now(); for (int32_t index = 0; index < count; ++index) { hardcode::naruto::Logger::getLogger()->fatal("%d hello world, %s\n", index, tmp.c_str()); //ERROR!!! } auto end = std::chrono::system_clock::now(); auto duration = std::chrono::duration_caststd::chrono::microseconds(end - start); std::cout << count << "次运行耗时" << duration.count() << "us" << std::endl; return 0; } 我这边测试在 hardcode::naruto::Logger::getLogger()->fatal("%d hello world, %s\n", index, tmp.c_str()); 地方出现崩溃问题。堆栈如下: Thread 1 "testMain" received signal SIGSEGV, Segmentation fault. __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120 120 ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory. (gdb) bt #0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120 #1 0x00007ffffe88d4a3 in _IO_vfprintf_internal (s=s@entry=0x7ffffffedd40, format=format@entry=0x800f587 "%d hello world, %s\n", ap=ap@entry=0x7ffffffee020) at vfprintf.c:1643 #2 0x00007ffffe8b88b0 in _IO_vsnprintf (string=0x842c470 "0 hello world, ", maxlen=, format=0x800f587 "%d hello world, %s\n", args=0x7ffffffee020) at vsnprintf.c:114 #3 0x00000000080092aa in hardcode::naruto::Logger::writeLog (this=0x842ae70, log_level=hardcode::naruto::LogLevel::FATAL, file_name=0x800f8b0 "../log.cpp", function_name=0x800f900 <hardcode::naruto::Logger::fatal(char const*, ...)::FUNCTION> "fatal", line_num=83, fmt=0x800f587 "%d hello world, %s\n", ap=0x7ffffffee020) at ../log.cpp:117 #4 0x0000000008008f46 in hardcode::naruto::Logger::fatal (this=0x842ae70, format=0x800f587 "%d hello world, %s\n") at ../log.cpp:83 #5 0x0000000008003e49 in main () at ./naruto_test.cpp:17 (gdb) 这个问题个人能力不足无法定位和解决。有大佬可以帮忙看一下嘛?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
测试代码如下:
int main() {
hardcode::naruto::LogConfig log_config;
hardcode::naruto::Logger::setGlobalConfig(log_config);
hardcode::naruto::Logger::getLogger()->addAppender(
"asyncfile", hardcode::naruto::LogAppenderInterface::Ptr(new hardcode::naruto::AsyncFileAppender("./lg/")));
const int32_t count = 10;
std::string tmp("testssss");
auto start = std::chrono::system_clock::now();
for (int32_t index = 0; index < count; ++index) {
hardcode::naruto::Logger::getLogger()->fatal("%d hello world, %s\n", index, tmp.c_str()); //ERROR!!!
}
auto end = std::chrono::system_clock::now();
auto duration =
std::chrono::duration_caststd::chrono::microseconds(end - start);
std::cout << count << "次运行耗时" << duration.count() << "us" << std::endl;
return 0;
}
我这边测试在 hardcode::naruto::Logger::getLogger()->fatal("%d hello world, %s\n", index, tmp.c_str()); 地方出现崩溃问题。堆栈如下:
Thread 1 "testMain" received signal SIGSEGV, Segmentation fault.
__strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
120 ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
(gdb) bt
#0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
#1 0x00007ffffe88d4a3 in _IO_vfprintf_internal (s=s@entry=0x7ffffffedd40, format=format@entry=0x800f587 "%d hello world, %s\n",
ap=ap@entry=0x7ffffffee020) at vfprintf.c:1643
#2 0x00007ffffe8b88b0 in _IO_vsnprintf (string=0x842c470 "0 hello world, ", maxlen=,
format=0x800f587 "%d hello world, %s\n", args=0x7ffffffee020) at vsnprintf.c:114
#3 0x00000000080092aa in hardcode::naruto::Logger::writeLog (this=0x842ae70, log_level=hardcode::naruto::LogLevel::FATAL,
file_name=0x800f8b0 "../log.cpp", function_name=0x800f900 <hardcode::naruto::Logger::fatal(char const*, ...)::FUNCTION> "fatal",
line_num=83, fmt=0x800f587 "%d hello world, %s\n", ap=0x7ffffffee020) at ../log.cpp:117
#4 0x0000000008008f46 in hardcode::naruto::Logger::fatal (this=0x842ae70, format=0x800f587 "%d hello world, %s\n") at ../log.cpp:83
#5 0x0000000008003e49 in main () at ./naruto_test.cpp:17
(gdb)
这个问题个人能力不足无法定位和解决。有大佬可以帮忙看一下嘛?
The text was updated successfully, but these errors were encountered: