File property in RollingFileAppender - logback Configuration - file

I have the following RollingFileappender in my logback configuration file.
<appender name="RollingFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>C:\Files\MyLogFile.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>C:\Files\MyLogFile.%d{yyyy-MM-dd}.log</FileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{60} [%file:%line] %msg%n</pattern>
</encoder>
</appender>
It does write to MyLogFile.log but does not append the date as specified in the FileNamePattern.
There is a simular question, but it never answered my confusion.
I should omit the file property.
Why is the file-property then usefull, because it seems to overrule the rolling-file activity.
This confuses me. Did is get something wrong?

The file property, when used along the fileNamePattern one, will define the name of the ACTIVE file, and only archived files will have that pattern as name. When the active file is rolled, a new archive file will be created with that name. From chapter 4 in the manual:
Note that the file property in RollingFileAppender (the parent of TimeBasedRollingPolicy) can be either set or omitted. By setting the file property of the containing FileAppender, you can decouple the location of the active log file and the location of the archived log files. The current logs will be always targeted at the file specified by the file property. It follows that the name of the currently active log file will not change over time. However, if you choose to omit the file property, then the active file will be computed anew for each period based on the value of fileNamePattern.
So it is useful when you want to have a fixed name, for example, if you need to send the active file programmatically and don't want to guess what the file name would be for the current date.
Also notice that file is a property inherited from the regular FileAppender.

Related

Logic Apps SharePoint Connector - Move file with new file name

We have a integration requirement to move files from one folder to another in SharePoint Online. The new file name in the destination folder needs to be suffixed with the current datetime. For instance, if the source filename is Myfile.csv, it should be moved with the new name Myfile_2021-04-15T15:39:23.csv to the destination folder.
Using the Logic App SharePoint Move file action, I haven't been able to achieve this
If another file is already there is an enum and I'm unable to provide a custom expression for it. Further, with this option files are only renamed if there's a file with the same name already existing in the destination folder. Whereas our requirement is to attach datetime to all files that are being transferred, independent whether the file already exist in the destination folder or not.
How can I best achieve this?
Thanks in advance for any assistance.
Since the "Move file" action doesn't provide a feature for us to specify the new file name, I think the requirement can't be implemented by this action. You can just use other action to do it.
For example, use "Get file content" action to get the file content.
Then use "Create file" action to create the new file in the location which you want.
You can specify a name which you want in the "File name" input box.
By the way, the "Get file content" action doesn't provide an expression of file name for us to use in second step. But I noticed that you have got Full path in your description, so you can substring the Full path to get the original file name. And then use utcNow() method to get the current date and append it to file name.

Is it possible to edit Logic app file system or SFTP trigger conditions to fire a logic app based on filename or extension?

I would like to trigger my logic app which is reading files from SFTP only if files with a certain name or extension are uploaded/modified. I want to avoid using multiple actions to check file name. Is there any possible way to edit File System/SFTP trigger conditions to check file name and accordingly trigger the logic app?
Yes you could. If you want to use trigger condition to check the file name, you have to use When a file is added or modified (properties only).
I test the one without properties only, I check the output is there any property to get the file name, and then I use #equals('47.txt',trigger()['outputs']['headers']['x-ms-file-name']) as trigger condition, however I get this error message.
So this trigger could not meet your requirement. Then I test with properties only, this output body has a property Displayname to get the file name. So I changed the codition to #equals('47.txt',trigger()['outputs']['body']['DisplayName']), with this codition, if the filename doesn't equal, it will be triggered, however it won't fired it.
Hope this could help you.

Create log file with custom name

How to create log file with custom file name in cakephp 2.5.1.
I am written following code
$this->log("Data : ".print_r($this->data,true),'debug');
It create's debug.log file in tmp/log folder but when I write custom name like
$this->log("Data : ".print_r($this->data,true),'data');
This code do not create any log file. My Question is how to create log file with custom name?
Same answer as for the other question: Start reading the manual. A huge part of the profession is to read documentation.
Changed in version 2.5.
CakeLog does not auto-configure itself anymore. As a result log files
will not be auto-created anymore if no stream is listening. Make sure
you got at least one default stream set up, if you want to listen to
all types and levels. Usually, you can just set the core FileLog class
to output into app/tmp/logs/:

RTC source control displaying a pending change when no change has been made

Within 'Pending Changes' RTC source control is listing my target folder as an outgoing change. My project is maven based. I have not made any changes to the target folder.
When I compare the target folder with the stream I am flowing to I there are no differences displayed :
Is there some other criteria that is causing the 'Pending Changes' view to list my target folder & how can I determine what change is being recognized by RTC ?
When I try and undo the changeset within the target folder I receive the error :
The little + in the black arrow above the 'target' directory means RTC detects said directory as a new element to be delivered.
That means you must have checked in that directory with the rest of your changes.
Generally, target should be ignored (ie never considered to be checked-in in the first place).
In your case, you should:
remove that directory from your changeset (assuming you didn't already complete the changeset): try undo on the target directory within your changeset.
(That would actually trigger, for a newly created element, the error message
"Undoing this change would produce an orphan with no parent folder").
Right-click and select "ignore"
(don't select "Reverse" on the changeset itself: it would roll back all the changes currently checked-in)
add it to your .jazzignore: the ignore option will add or create a .jazzignore, in order to declare your directory in it.
Of edit your .jazzignore if you have already one, with a content like:
core.ignore.recursive= \
{target}
Note: with ClearCase, the issue is different, since ClearCase doesn't detected what is private from what is checked-out (and you don't check out with RTC).
You need to ask explicitly for all private files or all checked out files.

Finding a file path

Which method of the File class can I use to return the absolute path of a text file whose name is already mentioned in the application. In other words, the name of the file or its relative path is not to be typed in by the user.
Either e.g. FileInfo.FullName in VB.Net
or I donĀ“t understand the question...

Resources