Have you tried running under the debugger with a breakpoint at setFile()?
That should show you the call stack and whether you really got there
through that main. If it was then that main would show up in the list of
processes that are running, although you might not be able to tell how it
was in
I've followed my application's usage of the `setFile()` command up the
chain of invocations to try to figure out what it's doing so that I can
implement something different for Log4j v2.
Ultimately, the function is invoked by the `main()` method of a file
`SandcastleService.jar`, where it is used
> On Aug 26, 2022, at 1:45 PM, Joel Griffith wrote:
>
>
> Its purpose is to change the output file of the Root Logger's FileAppender
> (we assume it has only one), or to add a new FileAppender to the Root
> Logger if one does not already exist. I can eliminate this use of
> FileAppender.setF
I've found this code which also uses the missing FileAppender.setFile()
method:
```
public static void setFileAppenderOutput(String filename) {
File file = new File(filename);
FileAppender fa = null;
Enumeration e = Logger.getRootLogger().getAllAppenders();
while (e.hasMoreElement
In Log4j 1.2 a Category was the base class for a Logger. So this would simply
be
looking for all the Appenders attached to the Logger. If a Category/Logger has
no
Appenders then it searches the parent hierarchy until it finds one. Note that
even
if it finds one if the Logger is configured as
I'm still trying to parse some Log4j v1 code for the update, and I hit
something I can't find.
The docs here:
https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#getAllAppenders()
say that the Logger.getAllAppenders() method "Get[s] the appenders
contained in this category
> As for delaying creating the file, that can be accomplished just by
> specifying createOnDemand=“true”.
Keep in mind, that this is not true for parent folders. Parent folders will be
created on initialization even before createOnDemand. (At least for
RollingFileAppenders)
This was my workarou
This code appears to doing two things:
1. Provide a custom setFile method to set the file name, buffer size,
and the append and bufferedIO flags. It also always sets immediateFlush
to false.
2. Only opens the file when fileNameConfigured is called.
Other than that it is just the standard FileApp
I guess I can. 90 lines isn't too big for an email, is it?
* start code *
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Writer;
import org.apache.logging.log4j.core.ap
This is a problem. Log4j supports Lookups, which usually eliminate the need
to override things like setFile since you can create a custom lookup to do
whatever needs to be done.
Is there any chance you can post the code so we can figure out what it does?
Ralph
> On Aug 15, 2022, at 8:21 AM, Jo
Thanks for the code and information, even though it's a dispiriting
answer. If I have to write a new file, it'll likely take me most of a
year, if I'm even able to do it at all. It looks like the only feasible
way to remediate this code is either to remove logging altogether or maybe
see if runni
I don't know what the old appender does, in part because I'm not a good
enough programmer to interpret it, and in part because the bulk of what it
does is contained in the source code of the classes that it subclasses, and
I don't have that v1 source code.
One thing I've figured out that it does i
Actually created new logger from scratch through code:
Here is relevant code
where pLogFilename is something like "MyServer.log"
public static void initialize(String pLogFilename, String
pConfigurationFilename) throws IOException {
// Make sure the filename has the proper date form
Yeah. You can't do that.
I had that problem too - you have to find a new way to do in log4j.
I can't look now, but I will find what I did and post it tomorrow.
Don't waste time trying to find a similar mechanism - it was something
rather different.
On Fri, Aug 12, 2022 at 6:18 PM Gary Gregory w
Joel,
Is it possible to use Log4j 2's much richer feature set as is? Perhaps you
could explain what is it your old appender does that requires custom code.
Gary
On Fri, Aug 12, 2022, 15:35 Joel Griffith wrote:
> I have a Java application containing a package written to use Log4j v1. I
> am st
15 matches
Mail list logo