我正在使用Caffe,它在加载神经网络时会向shell打印大量输出.
我想抑制输出,这可以通过设置GLOG_minloglevel=1
运行Python脚本来完成.我尝试使用以下代码执行此操作,但我仍然从加载网络获得所有输出.如何正确抑制输出?
os.environ["GLOG_minloglevel"] = "1"
net = caffe.Net(model_file, pretrained, caffe.TEST)
os.environ["GLOG_minloglevel"] = "0"
Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用glog标志log_dir.最近我导入了kubernetes库并开始让这个运行时出现恐慌
恐慌:./ aaa.test标志重新定义:log_dir
May 16 23:51:35 ecmdev03-core01 docker[26867]: goroutine 1 [running]:
May 16 23:51:35 ecmdev03-core01 docker[26867]: panic(0x15ebc60, 0xc8201aae90)
May 16 23:51:35 ecmdev03-core01 docker[26867]: /usr/local/go/src/runtime/panic.go:464 +0x3e6
May 16 23:51:35 ecmdev03-core01 docker[26867]: flag.(*FlagSet).Var(0xc8200160c0, 0x7f561118c1c0, 0xc8201aae40, 0x1bddd70, 0x7, 0x1d75860, 0x2f)
May 16 23:51:35 ecmdev03-core01 docker[26867]: /usr/local/go/src/flag/flag.go:776 +0x454
May 16 23:51:35 ecmdev03-core01 docker[26867]: flag.(*FlagSet).StringVar(0xc8200160c0, 0xc8201aae40, 0x1bddd70, 0x7, 0x0, 0x0, 0x1d75860, 0x2f)
May 16 23:51:35 ecmdev03-core01 docker[26867]: /usr/local/go/src/flag/flag.go:679 +0xc7
May 16 23:51:35 ecmdev03-core01 docker[26867]: flag.(*FlagSet).String(0xc8200160c0, 0x1bddd70, 0x7, 0x0, 0x0, 0x1d75860, 0x2f, 0xc8201aae30)
May 16 23:51:35 …
Run Code Online (Sandbox Code Playgroud) glog库正在(unknown)
堆栈跟踪中打印某些堆栈帧.
我在Ubuntu上18.04
使用标准libgoogle-glog-dev
包:
$ cat > t.cc
#include <glog/logging.h>
void h() { LOG(FATAL) << "test"; }
void g() { h(); }
void f() { g(); }
int main(int argc, char** argv) {
google::InitGoogleLogging(argv[0]);
f();
}
^D
Run Code Online (Sandbox Code Playgroud)
编译时的上述程序......
$ g++ t.cc -lglog
Run Code Online (Sandbox Code Playgroud)
......然后跑......
$ ./a.out
Run Code Online (Sandbox Code Playgroud)
...输出以下内容:
F1219 13:54:46.608317 13408 t.cc:3] test
*** Check failure stack trace: ***
@ 0x7f90ddd970cd google::LogMessage::Fail()
@ 0x7f90ddd98f33 google::LogMessage::SendToLog()
@ 0x7f90ddd96c28 google::LogMessage::Flush()
@ 0x7f90ddd99999 google::LogMessageFatal::~LogMessageFatal()
@ 0x56279a0a7b30 (unknown)
@ 0x56279a0a7b45 (unknown)
@ …
Run Code Online (Sandbox Code Playgroud) 在安装 RNPermissions 及其依赖项时,我遇到了一个错误。似乎是我的编译器或正在安装的包的问题。
错误:
checking whether the C compiler works... no
/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing: Unknown `--is-lightweight' option
Try `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/si/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b':
configure: error: C compiler cannot create executables
See `config.log' for more details
Run Code Online (Sandbox Code Playgroud)
完整输出:
$ pod install
Analyzing dependencies
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `Permission-Camera` from `../node_modules/react-native-permissions/ios/Camera.podspec`
Fetching podspec for `Permission-LocationAlways` from `../node_modules/react-native-permissions/ios/LocationAlways.podspec`
Fetching podspec for `Permission-LocationWhenInUse` from `../node_modules/react-native-permissions/ios/LocationWhenInUse.podspec`
Fetching podspec for `RNPermissions` …
Run Code Online (Sandbox Code Playgroud) 有谁知道如何在golang源代码中设置/修改日志目录?我想在源代码中设置日志目录,而不是-log_dir=
在cmdline中
如何更改Google glog中的输出目录?
我才发现 google::SetLogDestination(google::LogSeverity, const char* path)
尝试过:
google::SetLogDestination(ERROR, "C:\\log\\error.log);
google::InitGoogleLogging("Test");
LOG(ERROR) << "TEST";
Run Code Online (Sandbox Code Playgroud)
但没有写任何东西!
顺便说一句:如果你建议另一个轻量级,易于使用和线程安全的库,请告诉我!
感谢任何帮助!
我正在Mac OS Mojave和Xcode 10上测试React Native 0.56.0-rc.2.
运行:
react-native init TestProject --version="0.56.0-rc.2"
cd TestProject
npm run start
react-native run-ios
Run Code Online (Sandbox Code Playgroud)
这产生了一些长期错误.
输入Xcode让我失败config.h
了glog,我发现可以手动构建:
cd ./node_modules/react-native/third-party/glog-0.3.4
./configure && make && make install
Run Code Online (Sandbox Code Playgroud)
通过那个阶段,但让我接下来的另一个问题
(...)/node_modules/react-native/third-party/glog-0.3.4/src/glog/logging.h:85:10:
'gflags/gflags.h' file not found
Run Code Online (Sandbox Code Playgroud)
我无法在Google或Stack Overflow上找到任何与RN相关的内容,只能参考其他软件包以及在基于Debian的系统上安装这些软件包的说明.
这是一个已知的问题?
所以我有一个相当可观的程序,它偶尔会冻结。
该程序使用 Qt、开放场景图和谷歌日志记录。这种冻结发生在谷歌日志中的打印过程中。程序本身正在打印大量调试信息。我能够通过 gdb-server 连接到程序,这是堆栈跟踪:
#0 0x000000397ac0e030 in __write_nocancel () at ../sysdeps/unix/syscall-template.S:82
#1 0x00007f5eecb74aeb in google::LogMessage::SendToLog() () from /lib64/libglog.so.0
#2 0x00007f5eecb71fc7 in google::LogMessage::Flush() () from /lib64/libglog.so.0
#3 0x00007f5eecb721a9 in google::LogMessage::~LogMessage() () from /lib64/libglog.so.0
#4 0x00000000004874a6 in LSDB::process (this=0x242d918, lsp=0x25f9200, circuit=0x24c7af0) at ../src/model/trill/LSDB.cpp:481
#5 0x00000000004a0f6f in Circuit::rx (this=0x24c7af0, eth=0x246fdf0) at ../src/model/trill/Circuit.cpp:355
#6 0x000000000045c950 in Circuit::qt_static_metacall (_o=0x24c7af0, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffaade95a0)
at ../src/model/trill/Circuit.moc.cpp:55
#7 0x000000398798cb9f in QMetaObject::activate (sender=0x2470140, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffaade95a0)
at kernel/qobject.cpp:3547
#8 0x0000000000459610 in FramePublisher::subscription (this=0x2470140, _t1=0x246fdf0) at ../src/model/system/FramePublisher.moc.cpp:98 …
Run Code Online (Sandbox Code Playgroud) 我想在我的 expo 项目中分离 expo,以便在 expo detach 我运行 pod install 后获得裸反应本机项目给我带来这个错误,即在安装 glog 期间该脚本太旧或丢失
[!] C:/Program Files/Git/usr/bin/bash.exe -c
set -e
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
set -e
PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
CURRENT_ARCH="${CURRENT_ARCH}"
if [ -z "$CURRENT_ARCH" ] || [ "$CURRENT_ARCH" == "undefined_arch" ]; then
# Xcode 10 beta sets CURRENT_ARCH to "undefined_arch", this leads to incorrect …
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建包含的库,'gflags/gflags.h'
但无法找到它。
我用自制软件安装了 gflags 和 glog。
CMake 输出说:
-- Found installed version of gflags: /usr/local/lib/cmake/gflags
-- Detected gflags version: 2.2.2
-- Found Gflags: /usr/local/include
-- Found Glog: /usr/local/include
Run Code Online (Sandbox Code Playgroud)
运行时"cmake"
一切正常,没有错误。但是当我运行时"make install"
它无法构建并且它说"fatal error: 'gflags/gflags.h' file not found"
如何在 OsX 中构建需要 gflags 的库?