Search in sources :

Example 1 with Log

use of bisq.common.app.Log in project bisq-desktop by bisq-network.

the class BisqApp method init.

// NOTE: This method is not called on the JavaFX Application Thread.
@Override
public void init() throws Exception {
    String logPath = Paths.get(bisqEnvironment.getProperty(AppOptionKeys.APP_DATA_DIR_KEY), "bisq").toString();
    Log.setup(logPath);
    log.info("Log files under: " + logPath);
    Utilities.printSysInfo();
    Log.setLevel(Level.toLevel(bisqEnvironment.getRequiredProperty(CommonOptionKeys.LOG_LEVEL_KEY)));
    UserThread.setExecutor(Platform::runLater);
    UserThread.setTimerClass(UITimer.class);
    shutDownHandler = this::stop;
    // setup UncaughtExceptionHandler
    Thread.UncaughtExceptionHandler handler = (thread, throwable) -> {
        // Might come from another thread
        if (throwable.getCause() != null && throwable.getCause().getCause() != null && throwable.getCause().getCause() instanceof BlockStoreException) {
            log.error(throwable.getMessage());
        } else if (throwable instanceof ClassCastException && "sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData".equals(throwable.getMessage())) {
            log.warn(throwable.getMessage());
        } else {
            log.error("Uncaught Exception from thread " + Thread.currentThread().getName());
            log.error("throwableMessage= " + throwable.getMessage());
            log.error("throwableClass= " + throwable.getClass());
            log.error("Stack trace:\n" + ExceptionUtils.getStackTrace(throwable));
            throwable.printStackTrace();
            UserThread.execute(() -> showErrorPopup(throwable, false));
        }
    };
    Thread.setDefaultUncaughtExceptionHandler(handler);
    Thread.currentThread().setUncaughtExceptionHandler(handler);
    try {
        Utilities.checkCryptoPolicySetup();
    } catch (NoSuchAlgorithmException | LimitedKeyStrengthException e) {
        e.printStackTrace();
        UserThread.execute(() -> showErrorPopup(e, true));
    }
    Security.addProvider(new BouncyCastleProvider());
    final BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
    final String currencyCode = baseCurrencyNetwork.getCurrencyCode();
    Res.setBaseCurrencyCode(currencyCode);
    Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());
    CurrencyUtil.setBaseCurrencyCode(currencyCode);
    Capabilities.setSupportedCapabilities(new ArrayList<>(Arrays.asList(Capabilities.Capability.TRADE_STATISTICS.ordinal(), Capabilities.Capability.TRADE_STATISTICS_2.ordinal(), Capabilities.Capability.ACCOUNT_AGE_WITNESS.ordinal(), Capabilities.Capability.COMP_REQUEST.ordinal(), Capabilities.Capability.VOTE.ordinal())));
}
Also used : StageStyle(javafx.stage.StageStyle) ManualPayoutTxWindow(bisq.desktop.main.overlays.windows.ManualPayoutTxWindow) Arrays(java.util.Arrays) Utilities(bisq.common.util.Utilities) DaoManager(bisq.core.dao.DaoManager) Key(com.google.inject.Key) LoggerFactory(org.slf4j.LoggerFactory) Security(java.security.Security) StackPane(javafx.scene.layout.StackPane) DisputeManager(bisq.core.arbitration.DisputeManager) User(bisq.core.user.User) Application(javafx.application.Application) Parent(javafx.scene.Parent) ViewLoader(bisq.desktop.common.view.ViewLoader) AddressEntryList(bisq.core.btc.AddressEntryList) Res(bisq.core.locale.Res) SendAlertMessageWindow(bisq.desktop.main.overlays.windows.SendAlertMessageWindow) BlockStoreException(org.bitcoinj.store.BlockStoreException) INITIAL_SCENE_WIDTH(bisq.desktop.util.Layout.INITIAL_SCENE_WIDTH) VoteService(bisq.core.dao.vote.VoteService) Pane(javafx.scene.layout.Pane) Navigation(bisq.desktop.Navigation) Popup(bisq.desktop.main.overlays.popups.Popup) ClosedTradableManager(bisq.core.trade.closed.ClosedTradableManager) Capabilities(bisq.common.app.Capabilities) P2PService(bisq.network.p2p.P2PService) CachingViewLoader(bisq.desktop.common.view.CachingViewLoader) ArbitratorManager(bisq.core.arbitration.ArbitratorManager) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FilterManager(bisq.core.filter.FilterManager) PersistedDataHost(bisq.common.proto.persistable.PersistedDataHost) ShowWalletDataWindow(bisq.desktop.main.overlays.windows.ShowWalletDataWindow) KeyEvent(javafx.scene.input.KeyEvent) BaseCurrencyNetwork(bisq.core.btc.BaseCurrencyNetwork) BsqWalletService(bisq.core.btc.wallet.BsqWalletService) Platform(javafx.application.Platform) List(java.util.List) WalletsSetup(bisq.core.btc.wallet.WalletsSetup) DevEnv(bisq.common.app.DevEnv) TradeManager(bisq.core.trade.TradeManager) Logger(ch.qos.logback.classic.Logger) EmptyWalletWindow(bisq.desktop.main.overlays.windows.EmptyWalletWindow) AppOptionKeys(bisq.core.app.AppOptionKeys) Preferences(bisq.core.user.Preferences) UserThread(bisq.common.UserThread) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) EventStreams(org.reactfx.EventStreams) INITIAL_SCENE_HEIGHT(bisq.desktop.util.Layout.INITIAL_SCENE_HEIGHT) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) Scene(javafx.scene.Scene) AlertManager(bisq.core.alert.AlertManager) WalletService(bisq.core.btc.wallet.WalletService) CommonOptionKeys(bisq.common.CommonOptionKeys) ArrayList(java.util.ArrayList) WalletsManager(bisq.core.btc.wallet.WalletsManager) UITimer(bisq.desktop.common.UITimer) CurrencyUtil(bisq.core.locale.CurrencyUtil) Profiler(bisq.common.util.Profiler) LimitedKeyStrengthException(bisq.common.crypto.LimitedKeyStrengthException) InjectorViewFactory(bisq.desktop.common.view.guice.InjectorViewFactory) KeyCode(javafx.scene.input.KeyCode) Version(bisq.common.app.Version) Modality(javafx.stage.Modality) Label(javafx.scene.control.Label) FailedTradesManager(bisq.core.trade.failed.FailedTradesManager) ResultHandler(bisq.common.handlers.ResultHandler) Log(bisq.common.app.Log) IOException(java.io.IOException) BisqEnvironment(bisq.core.app.BisqEnvironment) Names(com.google.inject.name.Names) OpenOfferManager(bisq.core.offer.OpenOfferManager) BouncyCastleProvider(org.bouncycastle.jce.provider.BouncyCastleProvider) DebugView(bisq.desktop.main.debug.DebugView) Injector(com.google.inject.Injector) TimeUnit(java.util.concurrent.TimeUnit) View(bisq.desktop.common.view.View) MainView(bisq.desktop.main.MainView) Level(ch.qos.logback.classic.Level) Stage(javafx.stage.Stage) ImageUtil(bisq.desktop.util.ImageUtil) Paths(java.nio.file.Paths) Storage(bisq.common.storage.Storage) FilterWindow(bisq.desktop.main.overlays.windows.FilterWindow) SystemTray(bisq.desktop.SystemTray) Guice(com.google.inject.Guice) Image(javafx.scene.image.Image) ProposalCollectionsService(bisq.core.dao.proposal.ProposalCollectionsService) Platform(javafx.application.Platform) BlockStoreException(org.bitcoinj.store.BlockStoreException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) UserThread(bisq.common.UserThread) LimitedKeyStrengthException(bisq.common.crypto.LimitedKeyStrengthException) BaseCurrencyNetwork(bisq.core.btc.BaseCurrencyNetwork) BouncyCastleProvider(org.bouncycastle.jce.provider.BouncyCastleProvider)

Aggregations

CommonOptionKeys (bisq.common.CommonOptionKeys)1 UserThread (bisq.common.UserThread)1 Capabilities (bisq.common.app.Capabilities)1 DevEnv (bisq.common.app.DevEnv)1 Log (bisq.common.app.Log)1 Version (bisq.common.app.Version)1 LimitedKeyStrengthException (bisq.common.crypto.LimitedKeyStrengthException)1 ResultHandler (bisq.common.handlers.ResultHandler)1 PersistedDataHost (bisq.common.proto.persistable.PersistedDataHost)1 Storage (bisq.common.storage.Storage)1 Profiler (bisq.common.util.Profiler)1 Utilities (bisq.common.util.Utilities)1 AlertManager (bisq.core.alert.AlertManager)1 AppOptionKeys (bisq.core.app.AppOptionKeys)1 BisqEnvironment (bisq.core.app.BisqEnvironment)1 ArbitratorManager (bisq.core.arbitration.ArbitratorManager)1 DisputeManager (bisq.core.arbitration.DisputeManager)1 AddressEntryList (bisq.core.btc.AddressEntryList)1 BaseCurrencyNetwork (bisq.core.btc.BaseCurrencyNetwork)1 BsqWalletService (bisq.core.btc.wallet.BsqWalletService)1