Creating a log file with current time - c

I am trying to do something similar to Appending current time to a new log file each time log4j is initialized.
I am using log4c for logging. I would like to be able to create a new log file with each execution of the application. Is it possible to do this, by only modifying the log4crc config file.
All help will be greatly appreciated
ps: The tag I wanted to used is log4c, but it isn't there in SO

Doesn't seem to be possible via any config file. I had to modify the appender used to name the log file based on the current time. I used the functions time(), localtime() and strftime() to create the file name

I had a similar problem. It is now fixed in the current release, but Ubuntu for example still ships an older version without this facility.
See How to change log4c's default timezone?

Related

Serilog in UWP is not writing the log in D drive

I am using Serilog in my UWP application. I can write the log in App LocalState folder without any issue.
But now I want to write the logs in D: drive specific folder. I have added the broadFileSystemAccess restricted capability and enabled the full access from the settings.
But still it is not creating the file in the specified location and not raising any error.
Anyone know the fix for this? Thanks in advance.
var file = #"D:\Logs\Serilog.txt";
Serilog.Log.Logger = new LoggerConfiguration().WriteTo.File(file).CreateLogger();
There is a very important information about broadFileSystemAccess capability on the File access permissions document. I'm not sure if you note it.
This broadFileSystemAccess capability only works for APIs in the Windows.Storage namespace.
This point is very important. So, your issue actually is you need to check the LoggerConfiguration().WriteTo.File(file).CreateLogger() relevant method if it write to files by using the Windows.Storage APIs.
By my checking, it uses the StreamWriter method to write to files. But this method is not included in the Windows.Storage APIs. So, the issue was very obvious. You need to submit this issue to Github and let the officials to modify this method and make it work in UWP.
Or, if you're interested in serilog-sinks-file source code, you could download it and make the change by yourself, Then, you could compile a custom serilog library version for your UWP project.

write a version number when deliver in RTC

I want to have an API, in my server, that return the version of the code running on it.
To do so, I want to have the version number on a file, and I want it to be updated each time I deliver code into the stream in RTC.
Is there a plugin I can use, or some other way to achieve this?
RTC has no version number. A component is made by a succession of change-sets which can contains more than one file. A single file history is given by the change-sets that begin with file creation and continue to last modification. But as RTC provides streams to organize logic environment you can have streams with different history for the same file. In this context "version" has no sense. In order to work with RTC you have to think with change-set and not by single file changes.
I solved this issue with signing the manifest.mf file in every build using mvn and jenkins.
I wrote a short artical about my solution, hope someone will find it useful.

Is there anyway to know that in some folder some file just got created or deleted?

I thinking about some global hook, but googling for "file create hook" gave me nothing.
I doing folder explorer in my prog... and I would like to add / remove files from visual representation in my prog as soon as they got added / deleted / appeared (for network folders), instead of running loop to scan the folder all the time.
Is that possible? I hope for some WinAPI solution.
You can use ReadDirectoryChangesW which notifies you of changes in a specific directory.
Also you can use SHChangeNotifyRegister, which is a shell feature and also works for "shell" forlders..
I suggest to read the following article: Understanding ReadDirectoryChangesW - Part 1

Automate download of file dynamically generated by http request

I am trying to automate the download of a bunch of csv files that are generated from a database based on which checkboxes are selected on a form. The website generates the csv file with the click of a 'Download' button. I found the URL to the download prompt using Firebug (and determined how it changes based on checkbox selection), but am unsure how to use it since it is dynamically generated and does not contain a file path. An example URL is the following:
https://www.quantcast.com/download/plannerCSV?&d0Id=10&sc=1&mr=10000
What is the best way to go about doing this? I looked into the Python mechanize module and briefly glazed over pydermonkey, but had trouble finding documentation on downloading dynamically generated files. I also found some suggestions on other forums for using VBscript and Perl-- I prefer to use Python if possible since I am most familiar with it, but if another language is more appropriate, I will learn what I need in order to accomplish this task--I just hope to do it efficiently! Comments from anyone with experience/knowledge/insight on this topic would be appreciated.
Probably the easiest way for you to do this is to use the command line tool wget. If running a UNIX/Linux it's already there. If you're running Windows then a Win32 version can can be downloaded from: http://gnuwin32.sourceforge.net/packages/wget.htm
The you can use a shell/batch script that will download the file for you.
Example for Windows:
set id=10
set sc=1
set mr=10000
set my_url=https://www.quantcast.com/download/plannerCSV?&d0Id=%id%&sc=%sc%&mr=%mr%
set filename=planner.csv
wget %my_url% --output-document=%filename%
:
: do stuff with file
:

Get file size by ExtJS

how can I get size of a specific file by ExtJS, without using ActiveXObject (as recommended at some website), because my program just only run on Firefox?
Thank you so much!
(More detail: the file I want to get size in on my local, not on remote server)
Your code runs in a sandbox, without extensions like ActiveX you are not allowed access to the file system.
You can use a Flash object. Have a look into SWFUload

Resources