log4j.properties value filter - filter

Hi:
I am using log4f for the logging in my app,and I want to add a FileAppender to the log,so I have to set the file:
log4j.appender.fileout.File=E:\myapp\logs\log.html
I wonder if there is any way can replace the absolute file path?
Maybe using something like:
log4j.appender.fileout.File={something}\logs\log.html?

Sure it's possible:
log4j.appender.fileout.File=./logs/log.html
Where E:\myapp is your application path.

Related

Spring with spring.config.location

I am trying to point at path to external configuration file like this:
--spring.config.location=file: C:/Users/some_user/workspace/repository1/payment-api/payment.yml
and it doesn't work. Any idea why?
The proper prefix is file://. On Windows you need an extra "/" in the file URL if it is absolute with a drive prefix
Try file:///C:/Users/some_user/workspace/repository1/payment-api/payment.yml instead.

Changing configuration options for Marathon

I'd like to change set various configuration options for Marathon, and I'm unsure how to do this. For example, I'd like to add --event_subscriber http_callback to the launch command.
For each configuration you can create a file in the directory /etc/default/marathon where the filename is the name of the option and a single line in the file containing the value for that option.
Eg. Make a file /etc/default/marathon/event_subscriber that contains the line "http_callback"
This also works for mesos.
Actually the directory has to be /etc/marathon/conf. This is valid for 0.11.1.

Apache Camel Rename source file but do not move to .camel directory

Hi i'm using apache camel 2.9 with spring. My requirement is this.
camel looks for a file in a specific directory (e.g import) and the file format is this test_22-10-2015_p1.psv
After the file has been processed i need to rename the file to test_22-10-2015_p1_ACK.psv and keep it in the same folder without moving it to the .camel directory.
Is this possible
Thanks in advance
Yes read the documentation about the file file component and you can find the move option.
http://camel.apache.org/file2
You can use an expression to define the file name which uses the simple/file language
http://camel.apache.org/file-language.html
http://camel.apache.org/simple.html
So it would be something along the lines of
move=test_${file:name.noext}_ACK.${file:name.ext}
And then you need to make a exclude to skip files starting with test_ as you move the file to the same directory.
exclude=test_.*

Using Ruby to find a file with changing directory

I'm trying to find a file in which the directory will change its name with upcoming versions, so an example could be that it is located under /opt/here/test-1.44/bin/progname and will follow the format same time.
I'm looking to do something like if File.exist?("/opt/here/test-*/bin/progname") but is that the correct format? When searching around I'm also seeing references to using Dir, so would it be something like if Dir['/opt/here/*'.select { |f| f =~ /progname/} then ?
Thanks!
Do
Dir.glob("/opt/here/test-*/bin/progname").empty?
Use any? instead of empty? if you want true when there is such file.

Look for a configuration file with Ruby

I written a Ruby tool, named foobar, having a default configuration into a
file (called .foobar).
When the tool is executed without any params, the configuration file's params
can be used: ~/.foobar.
But, if the current tool's path is ~/projects/foobar and if
~/projects/foobar/.foobar exists, then this file should be used instead of
~/.foobar.
That's why the way to look for this configuration file should start from the
current folder until the current user folder.
Is there a simple way to look for this file?
cfg_file = File.open(".foobar", "r") rescue File.open("~/.foobar", "r")
Although to be honest, I almost always do two things: provide an option for a config file path, and allow overriding of default config values. The problem with the latter is that unless you know config files are ordered/have precedence, it can be confusing.
I would do this:
if File.exists(".foobar")
# open .foobar
else
# open ~/..
end

Resources