summaryrefslogtreecommitdiffstats
path: root/vespalog/src/test/java/com/yahoo/log/LogFileDbTest.java
blob: 4dd7bd0978c5d88dcdd2e52ebdf4799cf85ad3a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.log;

import java.io.File;
import static com.yahoo.vespa.defaults.Defaults.getDefaults;
import org.junit.Test;

/**
 * @author arnej
 */
public class LogFileDbTest {

    @Test
    public void canSave() {
        System.err.println("VH: "+System.getenv("VESPA_HOME"));
        File dir = new File(getDefaults().underVespaHome(LogFileDb.DBDIR));
        dir.mkdirs();
        if (dir.isDirectory()) {
            System.err.println("using directory: "+dir);
            new File(getDefaults().underVespaHome("logs/extra")).mkdirs();
            String fn = getDefaults().underVespaHome("logs/extra/foo-bar.log");
            LogFileDb.nowLoggingTo(fn);
            fn = getDefaults().underVespaHome("logs/extra/stamped-1.log");
            LogFileDb.nowLoggingTo(fn);
        } else {
            System.err.println("cannot create directory: "+dir);
        }
    }
}