View Javadoc
1   /*
2    * Licensed under the GPL License. You may not use this file except in compliance with the License.
3    * You may obtain a copy of the License at
4    *
5    *   https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
6    *
7    * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
8    * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
9    * PURPOSE.
10   */
11  package psiprobe.tools.logging.jdk;
12  
13  import java.io.File;
14  import java.nio.file.Path;
15  
16  import psiprobe.tools.Instruments;
17  
18  /**
19   * The Class JuliHandlerAccessor.
20   */
21  public class JuliHandlerAccessor extends Jdk14HandlerAccessor {
22  
23    @Override
24    public File getFile() {
25      String dir = (String) Instruments.getField(getTarget(), "directory");
26      String prefix = (String) Instruments.getField(getTarget(), "prefix");
27      String suffix = (String) Instruments.getField(getTarget(), "suffix");
28      String date = (String) Instruments.getField(getTarget(), "date");
29      return dir != null && prefix != null && suffix != null && date != null
30          ? Path.of(dir, prefix + date + suffix).toFile()
31          : getStdoutFile();
32    }
33  
34  }