In short, would there be any dangerous side effects if we copied all
environment variables from the forking process into the forked
processes?  Or is there a cleaner way to let users specify which to
pass on.

On Mon, Apr 4, 2022 at 4:44 PM Tim Allison <talli...@apache.org> wrote:
>
> I'm sorry.  I can't quite figure out what you're trying to do.
>
> I wanted separate logs for each pipesclient.  I did this:
>
>   <Appenders>
>     <File name="file-appender" 
> fileName="logs/client-${sys:pipesClientId}.log">
>       <PatternLayout pattern="%-5p [%t] %d{HH:mm:ss,SSS} %c %m%n"/>
>     </File>
>     <File name="pdfbox-appender"
> fileName="logs/pdfbox-${sys:pipesClientId}.log">
>       <PatternLayout pattern="%-5p [%t] %d{HH:mm:ss,SSS} %c %m%n"/>
>     </File>
>   </Appenders>
>
> The diff is that I did a smelly, hard-coding of injecting that
> variable into the forked process:
> https://github.com/apache/tika/blob/3eaf766b323b2a3d804268ae0e2bba6bd8e08117/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerWatchDog.java#L403
>
> Should we do a better job of inheriting or transferring the system
> variables from the forking to the forked process, e.g. copy everything
> starting with -D?
>
> On Mon, Apr 4, 2022 at 2:07 PM Josh Burchard <burch...@pnp-hcl.com> wrote:
> >
> > I'm trying to pass through a JVM system variable from the command line to 
> > the log4j2 instance being used by any Tika child process.  This variable 
> > substitution works fine, of course, for the parent process where my 
> > log4j2.xml line is like so:
> >
> > <RollingFile name="RollingAppender" fileName="${sys:logpath}" 
> > filePattern="${sys:logpath}.%i" append="false">
> >
> > And that's fed by my command line:
> >
> > java -Dlogpath="C:\tmp\logstore\foo.log" -jar tika-server.jar -c 
> > C:\tmp\configs\tika-config.xml
> >
> >
> > So in my tika-config.xml I tried the following thing for the child 
> > processes which doesn't work:
> >       <forkedJvmArgs>
> >         <arg>-Xms1g</arg>
> >         <arg>-Xmx1g</arg>
> >         <arg>-Dlogpath="${sys:logpath}"</arg>
> >         <arg>-Dlog4j.configurationFile="C:\tmp\configs\log4jTika.xml"</arg>
> >        </forkedJvmArgs>
> >
> >
> > I do see that if I set the above logpath arg to a literal value, that works 
> > but it's not what I'm going for.
> >
> > Can anyone think of a workaround for this?
> >
> >
> > -Josh Burchard : HCL

Reply via email to