Java Code Examples for org.pentaho.di.core.Const#getKettleDirectory()

The following examples show how to use org.pentaho.di.core.Const#getKettleDirectory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Log4jLogging.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void applyLog4jConfiguration() {
  LogLog.setQuietMode( true );
  LogManager.resetConfiguration();
  LogLog.setQuietMode( false );

  /**
   * On DOMConfigurator.doConfigure() no exception is ever propagated; it's caught and its stacktrace is written to System.err.
   *
   * @link https://github.com/apache/log4j/blob/v1_2_17_rc3/src/main/java/org/apache/log4j/xml/DOMConfigurator.java#L877-L878
   *
   * When the kettle5-log4j-plugin is dropped under ~/.kettle/plugins ( which is also a valid location for classic pdi plugins )
   * we get a System.err 'FileNotFoundException' stacktrace, as this is attempting to fetch the log4j.xml under a (default path) of
   * data-integration/plugins/kettle5-log4j-plugin; but in this scenario ( again, a valid one ), kettle5-log4j-plugin is under ~/.kettle/plugins
   *
   * With the inability to catch any exception ( as none is ever propagated ), the option left is to infer the starting path of this plugin's jar;
   * - If it starts with Const.getKettleDirectory(): then we know it to have been dropped in ~/.kettle/plugins ( a.k.a. Const.getKettleDirectory() )
   * - Otherwise: fallback to default/standard location, which is under <pdi-install-dir>/</>data-integration/plugins
   */
  final String log4jPath = getPluginPath().startsWith( getKettleDirPath() )
      ? ( Const.getKettleDirectory() + File.separator + PLUGIN_PROPERTIES_FILE ) : getConfigurationFileName();

  DOMConfigurator.configure( log4jPath );
}
 
Example 2
Source File: LanguageChoice.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public String getSettingsFilename() {
  return Const.getKettleDirectory() + Const.FILE_SEPARATOR + ".languageChoice";
}