Why doesn't glog support the setting of stdout? - go

By default, all log statements write to files in a temporary
directory. This package provides several flags that modify this
behavior. As a result, flag.Parse must be called before any logging is
done.
-logtostderr=false Logs are written to standard error instead of to files.
-alsologtostderr=false Logs are written to standard error as well as to files.
-stderrthreshold=ERROR Log events at or above this severity are logged to standard error as well as to files.
-log_dir="" Log files will be written to this directory instead of the default temporary directory.
As we can see in the documentation, all parameter settings are for stderr, no stdout. Why?
Why not expose stdout parameters(e.g., logtostdout,alsologtostdout,stdoutthreshold) to the user?
In addition, I think users should expect alsologtoSTDOUT=true as the default behavior in logging(i.e., logs are written to standard out as well as to files)

Related

protocol compilation using a remote file for Python (and others)

I am looking for a way to convince bash that "I've passed you a file, in the specified directory" without actually downloading and creating that directory on disk, OR pass a remote file directly to my protocol buffer compiler without writing it to disk.
I would like my protocol buffers compiler to look at a remote file, compile my classes, then finish without the .proto ever being downloaded.
I have this script which is getting us by for now
git archive --remote=git#bitbucket.org:redzoneco/asset-pipeline-protocol-buffers.git master preflight_check_service/preflight.proto | tar -x
preflight_check_service/preflight.proto
protoc --python_out=chalicelib/protos preflight_check_service/preflight.proto
rm -r preflight_check_service
but as you can see we make the directory locally, run protoc, then remove the file. Seems like a waste.
I don't think you'll be able to avoid using a temp file/directory as protoc doesn't accept it's input via stdin. There's an open ticket here, but it has received very little attention.
You could always just drop the .proto file into your destination and not worry about it. So, in your example, put it in chalicelib/protos. That'd help document what was created and why. (...for others if this is checked into source control, or just for your self if not.)

Disable file logging in spring boot

the spring-boot application automatically creates spring.log file under temp folder of user_path/AppData/Local/Temp/spring.log
I have a use case where I don't want any of my logs to be written in to log file, whereas I need them to be printed in console output.
How do I achieve this?
Remove logging properties
If you want to write log files in addition to the console output, you need to set a logging.file or logging.path property (for example, in your application.properties).
logging.path:
Writes spring.log to the specified directory. Names can be an exact location or relative to the current directory.
logging.file:
Writes to the specified log file. Names can be an exact location or relative to the current directory.

Getting file contents from TEE's Tf.Cmd command line

I am trying to get the file contents from a specific revision in TEE. According to https://msdn.microsoft.com/en-us/library/gg413270(v=vs.100).aspx the command should be something to the affect of : tf print -version:C1999 Class1.java. This is the error I am receiving:
An argument error occurred: The specified file does not exist at the specified version.
I know I am logged in and my credentials are cached as I am able to query for information like the History command. I also know that the file does exist in this revision as I am getting the information from the history query. Also using Tf.Exe (provided by visual studios) I am able to successfully run :
tf view -version:C1999 Class1.java
and get the contents perfectly fine. Unfortunately for this purpose I am unable to use tf.exe, and it has to the the TEE command line using Tf.Cmd, and they do not support the "view" command.
Any help on getting the file contents would be greatly appreciated.
edit- note I am using the full file path, and, as I said, it works perfectly fine in Tf.exe. Also I have tried using "$/" as the project root and still do not have any success.
Make sure you have installed the latest version of Team Explorer Everywhere.
To use this command, the Read permission on the file that you are
trying to print must be set to Allow.
Even though you could get tf view command to work. Also double check if you have related permission on that specific file.

How to swap out to a new file a running process output is redirecting to, without restarting the command?

I have a background process that I do not want to restart. Its output is actively being logged to a file.
nohup mycommand 1> myoutputfile.log 2>&1 &
I want to "archive" the file the process is currently writing its output to, and make it start writing to a blank file at the same file name. I must be able to do this without having to kill the process and start it again.
I tried simply renaming the existing file (to myoutputfile_.log), hoping that the shell now finding that the file is no longer there, will create a new file with the original file name (myoutputfile.log). But this does not work as the shell holds a reference to the file's location and keeps appending to it.
I looked here. On executing ls, I see that the streams are now marked as (deleted) but I'm quite confused what to do next. In the gdb command, do I have to specify the process executable in addition to the process ID? What happens if I don't specify it or I get it wrong? Once in gdb, how do I force the stream to re-create a file in the deleted file's same location (same path and filename)?
How can I use the commands in shell to signal it to start a new file for an existing process's output redirection?
PS: I can't do a trial-and-error because it's rather important I get this right. If it is relevant to know, this is a java process.
I resolved this issue by doing the following:
cp myoutputfile.log myoutputfile_.log; echo > myoutputfile.log
This essentially reset the log file after copying the original contents to a new file.

Running xcodebuild on command line, where to view logs?

I want to view the log when building an xcode (4.5) project from the command-line, since the output in the command-line window itself is too long and messy. Is there a standard place the logs would go, I can't seem to find them?
There are logs in ~/Library/Developer/Xcode/DerivedData -- you'll have to figure out which sub folder is for your build, but in there is Logs/Build/UUID.xcactivitylog
If you rename that file to a .zip and unzip, there's a text file log in there of the build.
Like all command line tools, output goes to standard output and error goes to standard error. By default this is your command line terminal. Use piping and/or redirection if you want them somewhere else. Check your command line interpreter documentation for more info (probably you are using bash, so check man bash).

Resources