How can i get the current log file name on runtime from tinylog - tinylog

i am using tinylog 2 and i want to load the current log file content to show it in my gui.
My tinylog.properties looks something like this:
writer=rolling file
writer.file=project_{date: yyyy-MM-dd}.log
So my problem is: How can i get the current filename of the logger file ?
i can resolve it with hard coded java String formatter, but when someone change the properties file it doesn't fit.
Is there a way to get the current resolved logfile name from Tinylog?
Thanks

tinylog 2 does not provide any specific API for receiving the file name. However, feel free to file a feature request on GitHub. As the main contributor of tinylog, I could imagine to implement such feature for tinylog 2 or 3. Especially, I'm thinking about a listener that could automatically inform you about a rollover event and provide the new file name.

Related

Roblox ModuleScript reporting Infinite yield possible on

Helping my kid learn to develop. Using Roblox as the tool.
We are in the ServerScriptService folder and in a file called OverheadRankScript. I have a line of code like this:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DataModule = require(ReplicatedStorage:WaitForChild("DataModule"))
My ModuleScript is in ReplicatedStorage folder and it is new and looks like this.
local module = {}
return module
I get the following error
Infinite yield possible on
'ReplicatedStorage:WaitForChild("DataModule")'
I copied the example from this link
https://developer.roblox.com/en-us/articles/Scope
Does ModuleScript script need to be in Replicated Storage or is Server Script Service the correct area?
Not sure what I am doing wrong should the file name be DataModule or is ModuleScript ok?
Does the variable need to change not sure the example provided in the documentation does not seem to work.
It's just a warning, but you can add a timeout to it for the warning to stop showing up.
local DataModule = require(ReplicatedStorage:WaitForChild("DataModule", 10))
The 10 is the optional timeout parameter that you can change to whatever you'd like to.
Actually what I found out was the DataModule needs to be renamed to ModuleScript. That Is the file name and it is referencing the file name. The example referenced in the link does not mention this at all. Infinite yield possible was misleading and it could not find the file.

Office URI schemes, new file from template(nft) not saving the file in provided location

We are creating a new file from template as specified in the Office Uri Schemes documentation.
As per the documentation we can give an optional parameter with |s to specify the default path offered as a save location when the file is first saved. The only restriction is that if the optional default save location is supplied, it must be pointing to the same host name as the template.
We are using Office 365 group drive to save the template and the default save location(for newly generated file) is also in the same group drive. But it is not picking the default save location as specified.
Following is the URI that we are testing.
ms-word:nft|u|https://figg.sharepoint.com/sites/1dev/Shared%20Documents/Config/Files/Minutes.dotx|s|https://figg.sharepoint.com/sites/1dev/Shared%20Documents/Dest
The above url when opened generate a new file from template but it did not give the default save location specified in the command when we try to save the file.
Any help if how to fix this would be very helpful.
Are you sure about your save URL ? It looks truncated as Dest...
If it's correct, make sure that it ends with a forward slash, like this:
ms-word:nft|u|https://figg.sharepoint.com/sites/1dev/Shared%20Documents/Config/Files/Minutes.dotx|s|https://figg.sharepoint.com/sites/1dev/Shared%20Documents/Dest/
You also must make sure you have the correct permissions to write back to that particular document library
HTH

Allow for non-existent files in FileFieldEditor [duplicate]

I'm setting up a series of preferences in my Eclipse (3.5.2) application and I'm having a problem with the FileFieldEditor. I want to allow the user to specify a log file to print output to. Often, this will be a new file. But when I use the file select dialog with FileFieldEditor, it complains that the file doesn't exists ("Value must be an existing file"). Is there a way, without extending the FileFieldEditor class, to suppress this error and have Java create that file if it doesn't exist? Thanks!
When I look the source code of org.eclipse.jface.preference.FileFieldEditor, the only solution would be to extend it and write your own version of a FileFieldEditor, with:
an overwritten changePressed() method in order to keep the file path even if the file does not exists
an overwritten checkState() method in order to avoid that error message.
So I do not see a way to avoid that FileFieldEditor extension here.

How to write an Enterprise Library dataConfig.config file?

I have 'inherited' a test harness application which uses Enterprise Library for its SQL data access. In the app.config file (enterpriselibrary.configurationSettings), it references a "configurationSection" with a path to "dataConfig.config", which is encrypted. I would like to change the database connection properties, but EntLibConfig.exe will not open the dataConfig.config or app.config (I have the FileKeyAlgorithmPairStorageProviderData file).
The test harness application runs, so its configured ok.
I can, in code, using (Microsoft.Practices.EnterpriseLibrary.Data.Configuration.ConfigurationManager.GetConfiguration("dataConfiguration")) read the data configuration, and can navigate all the instances and connection strings (security isn't an issue for this test harness). I can dump everything I need to a hand-crafted XML file (using GetType().AssemblyQualifiedName to get the full name for the classes which read the config file) and then change the app.config to read my new, unencrypted, xml dataConfig file.
All is fine, I can now change my database config settings.
However... given that ConfigurationManager.GetConfiguration("dataConfiguration") returns a fully populated instance of a DatabaseSettings object, is there not a method I can call which will write the XML file (dataConfig.config) for me ?
I appreciate that this is probably a really big hammer way to edit the data configuration, but after half a day of trying, I fell back on the old coding maxim... if you can't find the tool to do what you want, write your own !
Thanks
Well... turns out that its not that hard.
I added a new "configurationSection" to my app.config (dataConfiguration2), with encrypt set to false, with a path pointing to an new empty text file (dataConfiguration.config2). I then copied my encrypted dataConfiguration details using the following code:
using Entlib = Microsoft.Practices.EnterpriseLibrary.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data.Configuration;
:
DatabaseSettings settings = (DatabaseSettings)Entlib.ConfigurationManager.GetConfiguration("dataConfiguration");
Entlib.ConfigurationManager.WriteConfiguration("dataConfiguration2", settings);
...and it filled the empty file with the (unencrypted) configuration details.

Joomla template parameters and params.ini - file becomes unwritable after save

I am using wamp on Win XP SP3 and creating a Joomla template with changeable parameters.
initially the message is
The parameter file \templates\ssc_2010\params.ini is
writable!
once I make changes everything works as expected, except now i get the message:
The parameter file \templates\ssc_2010\params.ini is
unwritable!
One solution is to brows to the directory, right click the file, select properties, and uncheck read-only. Again the file is writable but once I modify the parameters again it becomes read only again. I'm quite lazy and would like to prevent this from happening again, I've notice this happening in past projects, but now I have to work a lot with parameters so it becomes quite boring doing manual labor like that :P
There is a bug in Joomla 1.5 that causes the message to be displayed.
A security feature was added that makes the template files unwritable until just before save, where they are made writable, saved, then made unwritable again.
Try to make a change, then go back and check the preview. You will see that the change was actually made.
If you want to fix the annoying unwritable message, add the following code to
administrator/components/controller.php around line 179, just after setting the FTP credentials:
$file = $client->path.DS.'templates'.DS.$template.DS.'params.ini';
// Try to make the params file writeable
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template parameter file writable'));
}
This will make the file writable during the edit load process, and before the file's status is posted in the template.
Then for security, in case the edit screen is closed without saving, search for the following lines:
require_once (JPATH_COMPONENT.DS.'admin.templates.html.php');
TemplatesView::editTemplate($row, $lists, $params, $option, $client, $ftp, $template);
and paste the following code just AFTER these lines but before the closing brace:
// Try to make the params file unwriteable
if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template parameter file unwritable'));
}
That will make the file unwritable again.
This is the same code that is used in the saveTemplate() function. We are just doing it again before we display the status of the file on the edit screen. If the process fails because of your web server's configuration, you will get warning messages, BEFORE you've made a bunch of changes to your template. :)
P.S. Remember to save a copy of this file separately, so that you can redo the changes when you upgrade Joomla! (if they haven't fixed this themselves yet.)
This sounds like a user rights problem within Windows - have a look a the security permissions for the directory in which the file you are editing is located, and check that the user "IUSR_xxx" (where xxx is the name of your computer) has full control.
If this doesn't work, then can you tell us what version of Windows you are running as this may help...
Matt