Neo4j: Does the Windows Service Wrapper actually log anything? - windows
I'm trying to debug the service wrapper for Neo4j Community Server and no matter what I've tried there is never a log file generated. Does the Windows-Wrapper actually generate log entries? The documentation references the neo4j-wrapper but not the windows-wrapper.
OS: Windows 8.1 or Windows Server 2012 R2
Neo4j: 2.1.4 or 2.1.7 Community
I changed the logging levels to ALL everywhere I could and the only log files generated are /data/neo4j.0.0.log which seems to only contain information about the HTTP endpoint and /data/graph.db/messages.log which has no references to the wrapper. I expected to find a log file called /data/log/windows-wrapper.0.0.log
Any ideas on what I've done wrong?
windows-wrapper.logging.properties
# Properties file which configures the operation of the JDK logging facility.
# The system will look for this config file, first using a System property
# specified at startup:
#
# >java -Djava.util.logging.config.file=myLoggingConfigFilePath
#
# If this property is not specified, then the config file is retrieved from its
# default location at:
# JDK_HOME/jre/lib/logging.properties
# Global logging properties.
# ------------------------------------------
# The set of handlers to be loaded upon startup.
# Comma-separated list of class names.
# (? LogManager docs say no comma here, but JDK example has comma.)
#handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
handlers=java.util.logging.FileHandler
# Default global logging level.
# Loggers and Handlers may override this level
# SERVERE, INFO, FINE, FINEST
.level=ALL
# Loggers
# ------------------------------------------
# Loggers are usually attached to packages.
# Here, the level for each package is specified.
# The global level is used by default, so levels specified here simply act as
# an override.
org.neo4j.server.level=ALL
# Handlers
# -----------------------------------------
# --- ConsoleHandler ---
# Override of global logging level
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=org.neo4j.server.logging.SimpleConsoleFormatter
java.util.logging.ConsoleHandler.filter=org.neo4j.server.logging.NeoLogFilter
# --- FileHandler ---
# Override of global logging level
java.util.logging.FileHandler.level=ALL
# Naming style for the output file (the output file is placed in the directory
# defined by the "user.home" System property):
# "/" the local pathname separator
# "%t" the system temporary directory
# "%h" the value of the "user.home" system property
# "%g" the generation number to distinguish rotated logs
# "%u" a unique number to resolve conflicts
# "%%" translates to a single percent sign "%"
java.util.logging.FileHandler.pattern=data/log/windows-wrapper.%u.%g.log
# Specifies whether the FileHandler should append onto any existing files
# (defaults to false):
java.util.logging.FileHandler.append=true
# Limiting size of output file in bytes (10M):
java.util.logging.FileHandler.limit=10000000
# Number of output files to cycle through, by appending an integer to the base
# file name:
java.util.logging.FileHandler.count=10
# The name of the character set encoding to use (defaults to the default
# platform encoding):
#java.util.logging.FileHandler.encoding=
# Style of output (Simple or XML):
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
logging.properties
# Properties file which configures the operation of the JDK
# logging facility.
# The system will look for this config file, first using
# a System property specified at startup:
#
# >java -Djava.util.logging.config.file=myLoggingConfigFilePath
#
# If this property is not specified, then the config file is
# retrieved from its default location at:
# JDK_HOME/jre/lib/logging.properties
# Global logging properties.
# ------------------------------------------
# The set of handlers to be loaded upon startup.
# Comma-separated list of class names.
# (? LogManager docs say no comma here, but JDK example has comma.)
handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
#handlers=java.util.logging.ConsoleHandler
# Default global logging level.
# Loggers and Handlers may override this level
# SEVERE, INFO, FINE, FINEST
.level=ALL
# Loggers
# ------------------------------------------
# Loggers are usually attached to packages.
# Here, the level for each package is specified.
# The global level is used by default, so levels specified here simply act as
# an override.
org.neo4j.server.level=ALL
# Handlers
# -----------------------------------------
# --- ConsoleHandler ---
# Override of global logging level
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=org.neo4j.server.logging.SimpleConsoleFormatter
#java.util.logging.ConsoleHandler.filter=org.neo4j.server.logging.NeoLogFilter
# --- FileHandler ---
# Override of global logging level
java.util.logging.FileHandler.level=ALL
# Naming style for the output file (the output file is placed in the directory
# defined by the "user.home" System property):
# "/" the local pathname separator
# "%t" the system temporary directory
# "%h" the value of the "user.home" system property
# "%g" the generation number to distinguish rotated logs
# "%u" a unique number to resolve conflicts
# "%%" translates to a single percent sign "%"
java.util.logging.FileHandler.pattern=data/log/neo4j.%u.%g.log
# Specifies whether the FileHandler should append onto any existing files
# (defaults to false):
java.util.logging.FileHandler.append=true
# Limiting size of output file in bytes (10M):
java.util.logging.FileHandler.limit=10000000
# Number of output files to cycle through, by appending an integer to the base
# file name:
java.util.logging.FileHandler.count=10
# The name of the character set encoding to use (defaults to the default
# platform encoding):
#java.util.logging.FileHandler.encoding=
# Style of output (Simple or XML):
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
Since I was the last person to make changes to that particular part of the codebase, I'll attempt an awswer: yes, we do do logging. Here, for example: https://github.com/neo4j/windows-wrapper/blob/master/src/main/java/org/neo4j/wrapper/NeoServiceWrapper.java#L49-60
That is only in the case where you launch it as a console app though, it seems. And I am not sure if the library we use does logging of it's own. And I have to admit that last I looked at this I didn't notice whether logging was indeed working or not.
So, I have not got any concrete advice for you at the moment. I'll make sure to make a note in the backlog to go over this. Meanwhile if you get a breakthrough let us know!
Lasse
Related
In Ruby, using Rdoc, how can aliases of methods to ENV be documented?
Starting with the very concrete issue I face, I want Rdoc to recognize documentation I placed around my monkeypatch of ENV: # ENV is a hash-like accessor for environment variables. ENV.singleton_class.class_eval do ## # :singleton-method: ENV::[name] # Returns the value for the environment variable +name+ if it exists. # # Note that unlike +ENV::fetch+, this method does not raise any error if the # requested key is valid and not set, but simply returns +nil+. # # This difference of behavior is taken into account in provided aliases. ## # Alternative to +ENV::[]+, that is, returns the value for the environment # variable name if it exists. # # This alias provide a trigraph which is moreover lexically close to the # classical get/set accessor identifiers. This let +get+ as a possible # alias for fetch, while giving a good hint on the fact that this method # is generally a quicker accessor – with less safety net. # # Merriam-Webster gives the following pertaining definition for jet: # transitive verb : to emit in a stream : spout # See: https://www.merriam-webster.com/dictionary/jet alias_method :jet, :[] ## # Trigraph alternative to +ENV::[]=+ and +ENV::store+. # # Merriam-Webster gives the following pertaining definition for sow: # To spread abroad; to propagate. # See: https://www.merriam-webster.com/dictionary/sow alias_method :sow, :[]= end So my goal is that when rdoc is run, it generates an entry for ENV in the Class and Module Index and document ::[] and its provided aliases. How might I do that?
How to download Github Raw CSV file using Ruby
I'm trying to grab an updated CSV file, COVID-19, that's posted on GitHub, but I keep getting an error that it's not there. It's a file that's constantly updated so I want to grab it at the source, which is GitHub. COVID-19 Time Series is the third item on the page. I tried the raw file URL, the CSV page URL, and GitHub consistently tells me that there is "no such file or directory". Here's my code: require 'open-uri' require 'csv' covids = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv" puts File.exist?(covids) keys = CSV.open(covids, &:readline) How can I reference this file? I know I am logged in, but Ruby should be able to see those file paths.
A URL is not a file, so you can't open it with CSV.open neither use it in a File.exist? call. I see you've already included open-uri in your code, so the quick way to solve this would be to download the file using open and pass it to CSV.open: keys = CSV.open(open(covids), &:readline) puts keys
The selected answer has some problems: OpenURI's open is deprecated. Instead use URI.open: pry(main)> open(covids) (pry):9: warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or use URI#open CSV.open, while it works, is counter to the signature of the method, which wants a filename, not an IO object. It's conceivable that relying on CSV.open to continue taking an IO object will break in the future if they fix this behavior. Instead, the CSV documentation's first example recommends: csv = CSV.new(string_or_io, **options) # Reading: IO object should be open for read csv.read # => array of rows # or csv.each do |row| # ... end ... foreach is the form of each I'd use because that fits my brain better, YMMV: CSV.foreach(URI.open(covids)) as a starting point. Here's an example looking at the first record in the file: require 'open-uri' require 'csv' covids = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv" CSV.foreach(URI.open(covids)).first # => ["Province/State", # "Country/Region", # "Lat", # "Long", # "1/22/20", # "1/23/20", # "1/24/20", # "1/25/20", # "1/26/20", # "1/27/20", # "1/28/20", # "1/29/20", # "1/30/20", # "1/31/20", # "2/1/20", # "2/2/20", # "2/3/20", # "2/4/20", # "2/5/20", # "2/6/20", # "2/7/20", # "2/8/20", # "2/9/20", # "2/10/20", # "2/11/20", # "2/12/20", # "2/13/20", # "2/14/20", # "2/15/20", # "2/16/20", # "2/17/20", # "2/18/20", # "2/19/20", # "2/20/20", # "2/21/20", # "2/22/20", # "2/23/20", # "2/24/20", # "2/25/20", # "2/26/20", # "2/27/20", # "2/28/20", # "2/29/20", # "3/1/20", # "3/2/20", # "3/3/20", # "3/4/20", # "3/5/20", # "3/6/20", # "3/7/20", # "3/8/20", # "3/9/20", # "3/10/20"] While OpenURI is convenient, it's not the most full-featured of the Ruby HTTP clients. I'd recommend working with something at the top of the Ruby HTTP client list. Also, write your code carefully so you don't beat your network or GitHub's following best practices for using HEAD requests to check the last time the file was updated; Don't repeatedly GET (download) a file that hasn't been updated because that's just bad network manners. At this point you'd be prepared to parse the file, saving the information to disk or reusing it for something else. I'd recommend dumping it into a database for easier reuse using something like Sequel, which makes it trivial to build and access the schema and data of SQLite writing to a disk-based DB, or PostgreSQL or MySQL for more full-featured DBMs.
zsh is not changing theme
Im trying to change the theme of zsh but I can't figure out what the problem is. This item didn't help me, because as you can see in my .zshrc file below my zsh source is after the zsh theme attribute. When I use echo $SHELL I receive: /usr/bin/zsh This is the theme that is being loaded although the theme set is robbyrussel: This is the ~/.zshrc file content: # If you come from bash you might have to change your $PATH. export PATH=$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH="/home/daniel/.oh-my-zsh" # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, # to know which specific one was loaded, run: echo $RANDOM_THEME # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes ZSH_THEME="robbyrussell" # Set list of themes to pick from when loading at random # Setting this variable when ZSH_THEME=random will cause zsh to load # a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ # If set to an empty array, this variable will have no effect. # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" # Uncomment the following line to use hyphen-insensitive completion. # Case-sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" # Uncomment the following line to automatically update without prompting. # DISABLE_UPDATE_PROMPT="true" # Uncomment the following line to change how often to auto-update (in days). # export UPDATE_ZSH_DAYS=13 # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS=true # Uncomment the following line to disable colors in ls. # DISABLE_LS_COLORS="true" # Uncomment the following line to disable auto-setting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. # ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. # COMPLETION_WAITING_DOTS="true" # Uncomment the following line if you want to disable marking untracked files # under VCS as dirty. This makes repository status check for large repositories # much, much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" # Uncomment the following line if you want to change the command execution time # stamp shown in the history command output. # You can set one of the optional three formats: # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # or set a custom format using the strftime function format specifications, # see 'man strftime' for details. # HIST_STAMPS="mm/dd/yyyy" # Would you like to use another custom folder than $ZSH/custom? # ZSH_CUSTOM=/path/to/new-custom-folder # Which plugins would you like to load? # Standard plugins can be found in ~/.oh-my-zsh/plugins/* # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=(git) source $ZSH/oh-my-zsh.sh # User configuration # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment # export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions # if [[ -n $SSH_CONNECTION ]]; then # export EDITOR='vim' # else # export EDITOR='mvim' # fi # Compilation flags # export ARCHFLAGS="-arch x86_64" # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. # For a full list of active aliases, run `alias`. # # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh"
you need to delete the .oh-my-zsh using rm -rf .oh-my-zsh and reinstall
How to fetch schema version using regex?
I have the following text: # encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20160405090205) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" I need to get 20160405090205 number. How can I get it? I've tried /version.*[0-9]/, but this captures only version: 20160405090205.
schema = File.read(Rails.root.join('db', 'schema.rb')) version, *_ = schema.match(/version: (\d+)/m).captures version # => "20160405090205" version, *_ = ... is needed here because captures returns an array even when there is a single capture.
You could get it a capture group string = "ActiveRecord::Schema.define(version: 20160405090205) do" version = string.match(/version: (\d+)/m).captures.first
Is there a .gemrc.local or equivalent?
Like many people I created a dotfiles repo and am trying extract bits that are not private into their respective dotfiles. I generally have a .whatever.local file loaded if it's present which might contain information I don't want checked into a repository. Rubygems use ~/.gemrc file, but I can't see a way to extract private information out of it into separate file. Does anyone know how this might be done? In particular I'd like to have the list of sources external to the .gemrc file.
I do not see an equivalent to .local as per v2.4.6 (a recent, but not last version). The source code of RubyGems states something relevant for what you want to achieve, though. For example, in src/ruby-2.3.0/lib/rubygems/config_file.rb: ## # Gem::ConfigFile RubyGems options and gem command options from gemrc. # # gemrc is a YAML file that uses strings to match gem command arguments and # symbols to match RubyGems options. # # Gem command arguments use a String key that matches the command name and # +:sources+:: Sets Gem::sources # +:verbose+:: See #verbose # # gemrc files may exist in various locations and are read and merged in # the following order: # # - system wide (/etc/gemrc) # - per user (~/.gemrc) # - per environment (gemrc files listed in the GEMRC environment variable) So you could use the GEMRC environment variable to load extra, private files as well.