Serilog - Log full of NUL characters - serilog

I have a Serilog implementation on a C# application. While debugging in our development environment we like to have the log file open in a text editor, like Notepad++.
As I debug and test I like to clean the log file as I go by deleting all the text and saving the file - while the application is still running.
When the application then next writes a log entry, the log is filled with 'NUL' characters.
It is as through Serilog wants to continue to append the log at the last known index point.
I just want it to write cleanly at the start of the log file again.
Is there is a way to do this?
I don't recall having this outcome when using Log4Net.

Related

How do I log to stdout or stderr from an Erlang common test suite?

I'm using common_test and just want to log values to stdout or stderr.
How????
I've tried:
ct:comment
ct:log
io:format
The state of the art seems to be manually combing through html files. But I'm on a server and I don't care about anything except my log line, I only want stdout. And I never want to look at an HTML file when writing tests, so advice on how to avoid that generally would be really helpful.
You should use ct:print or ct:pal (print and log), I'd recommend using the later, though.
(You can always use erlang:display, which is a low-level access to stdout)
Keep in mind that if you use Rebar3 with the default configuration and ct values. ct:print is only shown with --verbose, whereas, ct:pal is only shown if the test fails.

Applescript: print first or other specific pages

How can you instruct an application or the printer to only print the first page, a page range or just odd or even pages of a file? I attempt this with the help of the Preview app, which looks promising:
set theFile to "[file-path/file]""
tell application "Preview"
activate
print theFile with properties {target printer:"Printer", ending page:1} without «class pdlg»
--these properties isn't available for the printer app, here just limiting amount of printed pages
quit
end tell
But with this I'm bitten by the sandboxd process that tells me the file can't be opened for printing and I get a deny file-read-data result in the log.
In the CUPS suggestion by adamh I encounter issues with umlauts and have other execution issues as well, possibly also because of sandbox rules. The code works from the command line, but not when called in automated fashion.
I tried to look up useful examples of the print command in a reference, in my books and tried searching the online Apple references, but I can't seem to find many examples fitting to the present day situation with sandbox, if any.
You could script printing by command line tool lp & lpr.
These talk to CUPS, Common Unix Printing System
To target pages / ranges:
lp -o page-ranges=2-4 "my_great_document.pdf"
To call it from applescript use do shell script
e.g,
do shell script "lp -o page-ranges=2-4 'my_great_document.pdf'"
For more ideas see: http://www.cups.org/documentation.php/options.html

Grails console open with default or last file

Is there a way to configure grails console to open either with default file or with last opened file?
If you are worried about closing the console every time you bounce the app or do any kind of change that would involve a compile/run-app, then you can use the console plugin instead.
You do not have to close the browser while the restart is in process. I hope this would quench the thirst for your console to some extent. :)

NSLog / Log4Cocoa console logs needs to be saved in file

For my application i need to save all kind of console logs in the text or log file. I am using Log4Cocoa to generating different kind of logs. So how can i save all those console logs into the file? Could anyone please help me.
Thanks
With Log4Cocoa, each logger can have one or more destinations attached to it. So, if you attach a file appender to the root logger object, every log message will be sent to that file. When you initialize the logging system, add something like:
NSString *logFileName = #"path-to-your-log-file";
[[L4Logger rootLogger] addAppender:
[[L4FileAppender alloc] initWithLayout:[L4Layout simpleLayout]
fileName:logFileName];
If you use the L4FileAppender, the file you write to can grow without bounds. So, you might consider using either an L4RollingFileAppender or L4DailyRollingFileAppender instead. The L4RollingFileAppender rolls the file based on file size. The L4DailyRollingFileAppender rolls the file based on time. Despite what the name suggests, you can configure an L4DailRollingFileAppender to roll at different time periods (every minute, every hour, every 1/2 day, etc.).
If you do use a file appender, then you need to give some thought to how you are going to get the log files off of your device, particularly if you need to do logging in the production version of your application.
Much as I like the elegance of Log4Cocoa, I wound up switching to NSLogger (https://github.com/fpillet/NSLogger) and you might want to give it a look.

Is there any means to log the system logs in a separate file in iOS?

I am using CocoaLumberjack to log whatever things that I require for debugging.
In addition to that I also require some additional console messages to be printed out, i.e. certain warnings that were raised in the system console etc.
Is there any means I can get the logs from the system console?
Xcode->organizer->devices->your device->console

Resources