Create custom log format in RubyMine - regex

In my Ruby program, I use logger to export log to file.
But when I open .log file in Rubymine, it show 'log format not recognized'
My log file content is :
E, [2019-05-09T11:29:09.915477 #23628] ERROR -- : quang.log: No time
E, [2019-05-09T11:29:09.915712 #23628] ERROR -- : quang.log: /home/quang/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:109:in `sleep'
/home/quang/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:109:in `wait'
/home/quang/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:109:in `wait'
/home/quang/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/cassandra-driver-3.2.3/lib/cassandra/future.rb:622:in `block in get'
/home/quang/.rbenv/versions/2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
I tried to add new log format like this:
^([\w]+),\s+\[([^\]\s]+)\s+#([^\]]+)]\s+(\w+)\s+--\s+(\w+)?:\s+(.+)$
It does match with :
E, [2019-05-09T11:29:09.915477 #23628] ERROR -- : quang.log: No time
But notification above doesn't disappear.
How do I fix this?

Related

Unable to change the Regional format for EC2 instance via User-Data script

I am trying to change the EC2 instance's Regional format setting:
to en-GB by running Set-Culture en-GB command in my user-data script:
<powershell>
# set timezone to GMT
tzutil /s "GMT Standard Time"
# set the date format to the UK -> dd/mm/yyyy (we set it at IIS server level which would apply to all IIS apps automatically)
c:\windows\system32\inetsrv\appcmd.exe set config /commit:WEBROOT /section:globalization /culture:en-GB
c:\windows\system32\inetsrv\appcmd.exe set config /commit:WEBROOT /section:globalization /uiCulture:en-GB
# Set Regional format to UK (affects setting in Region Settings/Region/Regional format dropdown menu)
Set-Culture en-GB
</powershell>
<runAsLocalSystem>true</runAsLocalSystem>
However, when the instance boots up and I RDP to it, I find that the date format is still the default (US) - mm/dd/yyyy and not the UK format - dd/mm/yyyy
What am I missing here?
Update1
User-Data execution log:
2022/10/16 16:43:00Z: Begin user data script process.
2022/10/16 16:43:00Z: Unable to parse <persist> tags. This can happen when tags are unmatched or poorly formed.
2022/10/16 16:43:00Z: Sending telemetry bool: IsUserDataScheduledPerBoot
2022/10/16 16:43:00Z: Unregister the scheduled task to persist user data.
2022/10/16 16:43:05Z: Unable to parse <runAsLocalSystem> tags. This can happen when tags are unmatched or poorly formed.
2022/10/16 16:43:05Z: Unable to parse <script> tags. This can happen when tags are unmatched or poorly formed.
2022/10/16 16:43:05Z: Unable to parse <powershellArguments> tags. This can happen when tags are unmatched or poorly formed.
2022/10/16 16:43:05Z: <powershell> tag was provided.. running powershell content
2022/10/16 16:43:12Z: User data script completed.
2022/10/16 17:03:06Z: Begin user data script process.
2022/10/16 17:03:06Z: Failed to get metadata: The result from http://169.254.169.254/latest/user-data was empty
2022/10/16 17:03:11Z: Launch metadata did not include a user data script.
2022/10/16 17:03:11Z: User data script completed.
2022/10/20 08:27:33Z: Begin user data script process.
2022/10/20 08:27:33Z: Failed to get metadata: The result from http://169.254.169.254/latest/user-data was empty
2022/10/20 08:27:38Z: Launch metadata did not include a user data script.
2022/10/20 08:27:38Z: User data script completed.
2022/10/21 09:50:52Z: Begin user data script process.
2022/10/21 09:50:52Z: Unable to parse <persist> tags. This can happen when tags are unmatched or poorly formed.
2022/10/21 09:50:52Z: Sending telemetry bool: IsUserDataScheduledPerBoot
2022/10/21 09:50:52Z: Unregister the scheduled task to persist user data.
2022/10/21 09:50:57Z: <runAsLocalSystem> tag was provided: true
2022/10/21 09:50:57Z: Running user data as local system.
2022/10/21 09:50:57Z: Unable to parse <script> tags. This can happen when tags are unmatched or poorly formed.
2022/10/21 09:50:57Z: Unable to parse <powershellArguments> tags. This can happen when tags are unmatched or poorly formed.
2022/10/21 09:50:57Z: <powershell> tag was provided.. running powershell content
2022/10/21 09:52:36Z: Message: The errors from user data script: New-Item : An item with the specified name C:\temp already exists.
At
C:\Windows\system32\config\systemprofile\AppData\Local\Temp\Amazon\EC2-Windows\Launch\InvokeUserData\UserScript.ps1:96
char:1
+ New-Item -Path "C:\temp" -ItemType Directory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceExists: (C:\temp:String) [New-Item], IOException
+ FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand
2022/10/21 09:52:36Z: Message: The output from user data script: Join Domain User: ENR\svc_enr_domainjoin
ComputerName: EC2AMAZ-K1I0FAF
Reboot Required...
VERBOSE: Performing the operation "Join in domain 'ENR.cloud'" on target "EC2AMAZ-K1I0FAF".
HasSucceeded ComputerName
------------ ------------
True EC2AMAZ-K1I0FAF
WARNING: The changes will take effect after you restart the computer EC2AMAZ-K1I0FAF.
LocalPath : Z:
RemotePath : \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev
RequireIntegrity : False
RequirePrivacy : False
Status : OK
UseWriteThrough : False
PSComputerName :
Backing up IIS config to backup named 20221021-095225-Login
Creating virtual directories on site: Login
... Adding a virtual directory 'AnnouncementImages' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\AnnouncementImages
- Virtual directory 'IIS:\Sites\Login\AnnouncementImages' created sucessfully
... Adding a virtual directory 'apr' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\WebsiteCharts\oldAPRStructure
- Virtual directory 'IIS:\Sites\Login\apr' created sucessfully
... Adding a virtual directory 'AprSchematics' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\WebsiteCharts\apr\schematics
- Virtual directory 'IIS:\Sites\Login\AprSchematics' created sucessfully
... Adding a virtual directory 'BprDiagrams' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\WebsiteCharts\bpr\diagrams
- Virtual directory 'IIS:\Sites\Login\BprDiagrams' created sucessfully
... Adding a virtual directory 'Charts' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\WebsiteCharts
- Virtual directory 'IIS:\Sites\Login\Charts' created sucessfully
... Adding a virtual directory 'dls' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\dls
- Virtual directory 'IIS:\Sites\Login\dls' created sucessfully
... Adding a virtual directory 'Pre00CprData' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\Pre2000\cpr
- Virtual directory 'IIS:\Sites\Login\Pre00CprData' created sucessfully
... Adding a virtual directory 'Pre00DprData' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\Pre2000\dpr
- Virtual directory 'IIS:\Sites\Login\Pre00DprData' created sucessfully
... Adding a virtual directory 'Pre15BprData' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\Pre2000\bpr
- Virtual directory 'IIS:\Sites\Login\Pre15BprData' created sucessfully
... Adding a virtual directory 'WBook' for physical path \\myTeamreview_eu_dev.enr.ihsenergy.com\myTeamreview_eu_dev\Archive\Barra\live_content\wbook
- Virtual directory 'IIS:\Sites\Login\WBook' created sucessfully
Applied configuration changes to section "system.web/globalization" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT"
Applied configuration changes to section "system.web/globalization" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT"
PSPath : Microsoft.PowerShell.Security\Certificate::LocalMachine\my\0F006BBA30488C454380998CD818B7933
CBABB7F
PSParentPath : Microsoft.PowerShell.Security\Certificate::LocalMachine\my
PSChildName : 0F006BBA30488C454380998CD818B7933CBABB7F
PSIsContainer : False
Archived : False
Extensions : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid,
System.Security.Cryptography.Oid, System.Security.Cryptography.Oid}
FriendlyName : myTeamId
IssuerName : System.Security.Cryptography.X509Certificates.X500DistinguishedName
NotAfter : 10/21/2023 10:02:35 AM
NotBefore : 10/21/2022 9:42:35 AM
HasPrivateKey : True
PrivateKey :
PublicKey : System.Security.Cryptography.X509Certificates.PublicKey
RawData : {48, 130, 3, 42...}
SerialNumber : 3A249AE70AC9BC96464EDE49BEDD319B
SubjectName : System.Security.Cryptography.X509Certificates.X500DistinguishedName
SignatureAlgorithm : System.Security.Cryptography.Oid
Thumbprint : 0F006BBA30488C454380998CD818B7933CBABB7F
Version : 3
Handle : 1568489766128
Issuer : CN=EC2AMAZ-K1I0FAF
Subject : CN=EC2AMAZ-K1I0FAF
EnhancedKeyUsageList : {Client Authentication (1.3.6.1.5.5.7.3.2), Server Authentication (1.3.6.1.5.5.7.3.1)}
DnsNameList : {EC2AMAZ-K1I0FAF}
SendAsTrustedIssuer : False
EnrollmentPolicyEndPoint : Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty
EnrollmentServerEndPoint : Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty
PolicyId :
2022/10/21 09:52:36Z: User data script completed.

No local SparkleFormation files detected

So I've been working in sparkleformation and had this issue pop up even though all my files exist:
[WARN]: No local SparkleFormation files detected
[ERROR]: Failed to locate any templates!
[FATAL]: Invalid formation file path provided:
ERROR: IOError: Failed to locate file:
I wanted to create this question for future reference. This is what happens if you create a sparkleformation template and place any code outside of the Sparkleformation.new block. For example this would cause the above failure:
yamlfile = YAML.load_file(ENV['YAMLFILE_YML_PATH'])
SparkleFormation.new(:somename, :provider => :aws).load(:base).overrides do
yamlfile.keys.each { |key| yamlfile[key.to_sym] = yamlfile.delete(key)}
dynamic!(:someother name, :test_eips, yamlfile)
end
This will work:
SparkleFormation.new(:somename, :provider => :aws).load(:base).overrides do
yamlfile = YAML.load_file(ENV['YAMLFILE_YML_PATH'])
yamlfile.keys.each { |key| yamlfile[key.to_sym] = yamlfile.delete(key)}
dynamic!(:someother name, :test_eips, yamlfile)
end

Best way to save a file using NSDocument?

I'm encountering problems saving a document as I can see in the debug area:
NSFileVersion tried to tried to add a new generation and failed. Versioned file URL: file:///Users/mike97/Downloads/test%20copy.xml, contents URL: file:///Users/mike97/Downloads/test%20copy~.xml, error: Error Domain=GSLibraryErrorDomain Code=2 "Unable to open /Users/mike97/Downloads/test copy~.xml" UserInfo={NSDescription=Unable to open /Users/mike97/Downloads/test copy~.xml, NSUnderlyingError=0x608000856020 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSDescription=No such file or directory}}}
2017-06-19 20:19:53.069020+0200 XML Parser[2095:54823] NSDocument failed to preserve the old version of a document. Here's the error:
Error Domain=GSLibraryErrorDomain Code=2 "Unable to open /Users/mike97/Downloads/test copy~.xml" UserInfo={NSDescription=Unable to open /Users/mike97/Downloads/test copy~.xml, NSUnderlyingError=0x608000856020 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSDescription=No such file or directory}}}
2017-06-19 20:19:53.118611+0200 XML Parser[2095:54823] <XML_Parser.Document: 0x6000001014d0>: An error occurred while attempting to preserve the backup file at file:///Users/mike97/Downloads/test%20copy~.xml: Error Domain=GSLibraryErrorDomain Code=2 "Unable to open /Users/mike97/Downloads/test copy~.xml" UserInfo={NSDescription=Unable to open /Users/mike97/Downloads/test copy~.xml, NSUnderlyingError=0x608000856020 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSDescription=No such file or directory}}} ##
The app try to atomically save a file called 'test copy.xml' and doing this just rename that file to 'test copy~.xml', why cannot found the original one. In fact changing the option parameter saving the data the error gone.
This is the code I'm using in my NSDocument subclass:
override func writeSafely(to url: URL, ofType typeName: String, for saveOperation: NSDocument.SaveOperationType) throws {
if let vc = self.windowController?.contentViewController as? ViewController {
switch typeName {
case "XML v1":
do {
try vc.parser?.save().write(to: url, options: [])
} catch {
throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
}
break
..
In NSData.WritingOptions we can found some of the options to save a file, but I'm not sure what of them I need. Anyone care to explain me what they are and what are the best using the 'writeSafely' method chosen by me?
Also that method handles possible errors, so that a non-atomic write operation appear to be enough, but I wonder on how can I preserve the 'versioning' functionality by macOS.

How can I make file association in Qt installer(1.5.0)?

How can I make file association in Qt installer framework(1.5.0) on Windows? I want to do this:
For example, when I double click myFile.x then my qt desktop application(Windows) will launch and open this file.
I want to correct this in installscript.qs :
component.addOperation("CreateShortcut", "#TargetDir#/A.exe", "#StartMenuDir#/A.lnk");
component.addOperation("RegisterFileType",
"fl",
"#TargetDir#\\A.exe" + "'%1'",
"myFiles",
"text/plain",
"#TargetDir#/A_icon.ico",
"ProgId=A.fl");
component.addOperation("CreateShortcut", "#TargetDir#/uninstall.exe", "#StartMenuDir#/Uninstall.lnk");
When I write this string, it gives parse error.
Output is :
Caught exception: Exception while loading component script: 'D:/Workspace/A/A_installer/A/packages/com.ge.mss/meta/installscript.qs
SyntaxError: Parse error
Backtrace:
()#D:/Workspace/A/A_installer/A/packages/com.ge.mss/meta/installscript.qs:102'
If you are using windows just follow this:
component.addOperation("RegisterFileType",
"bob",
"#TargetDir#\\BobiSoft.exe \" %1\"",
"BobiSoft Files",
"application/x-binary",
"#TargetDir#/bobi_file_icon.ico",
"ProgId=BobiSoft.bob");
I also had this problem, the trick was to replace the ' %1' as many examples say, with \" %1\".

pig REPLACE gives error

Let's assume that my file is named 'data' and looks like this:
2343234 {23.8375,-2.339921102} {(343.34333,-2.0000022)} 5-23-2013-11-am
I need to convert the 2nd field to a pair of coordinate numbers. So I wrote the follwoing code and called it basic.pig:
A = LOAD 'data' AS (f1:int, f2:chararray, f3:chararray. f4:chararray);
B = foreach A generate STRSPLIT(f2,',').$0 as f5, STRSPLIT(f2,',').$1 as f6;
C = foreach B generate REPLACE(f5,'{',' ') as f7, REPLACE(f6,'}',' ') as f8;
and then used (float) to convert the string to a float. But, the command 'REPLACE' fails to work and I get the following error:
-bash-3.2$ pig -x local basic.pig
2013-06-24 16:38:45,030 [main] INFO org.apache.pig.Main - Apache Pig version 0.11.1 (r1459641) compiled
Mar 22 2013, 02:13:53 2013-06-24 16:38:45,031 [main] INFO org.apache.pig.Main - Logging error messages to: /home/--/p/--test/pig_1372117125028.log
2013-06-24 16:38:45,321 [main] INFO org.apache.pig.impl.util.Utils - Default bootup file /home/isl/pmahboubi/.pigbootup not found
2013-06-24 16:38:45,425 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine - Connecting to hadoop file system at: file:///
2013-06-24 16:38:46,069 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during parsing. Lexical error at line 7, column 0. Encountered: <EOF> after : ""
Details at logfile: /home/--/p/--test/pig_1372117125028.log
And this is the details of the pig_137..log
Pig Stack Trace
---------------
ERROR 1000: Error during parsing. Lexical error at line 7, column 0. Encountered: <EOF> after : ""
org.apache.pig.tools.pigscript.parser.TokenMgrError: Lexical error at line 7, column 0. Encountered: <EOF> after : ""
at org.apache.pig.tools.pigscript.parser.PigScriptParserTokenManager.getNextToken(PigScriptParserTokenManager.java:3266)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.jj_ntk(PigScriptParser.java:1134)
at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:104)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:194)
at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:170)
at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:84)
at org.apache.pig.Main.run(Main.java:604)
at org.apache.pig.Main.main(Main.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:197)
================================================================================
I've got data like this:
2724 1919 2012-11-18T23:57:56.000Z {(33.80981975),(-118.105289)}
2703 6401 2012-11-18T23:57:56.000Z {(55.83525609),(-4.07733138)}
1200 4015 2012-11-18T23:57:56.000Z {(41.49609152),(13.8411998)}
7104 9227 2012-11-18T23:57:56.000Z {(-24.95351118),(-53.46538723)}
and I can do this:
A = LOAD 'my_tsv_data' USING PigStorage('\t') AS (id1:int, id2:int, date:chararray, loc:chararray);
B = FOREACH A GENERATE REPLACE(loc,'\\{|\\}|\\(|\\)','');
C = LIMIT B 10;
DUMP C;
This error
ERROR 1000: Error during parsing. Lexical error at line 7, column 0. Encountered: <EOF> after : ""
came to me because I had used different types of quotation marks. I started with ' and ended with ยด or `, and it took quite a while to find what went wrong. So it had nothing to do with line 7 (my script was not so long, and I shortened data to four lines which naturally did not help), nothing to do with column 0, nothing to do with EOF of data, and hardly anything to do with " marks which I didn't use. So quite misleading error message.
I found the cause by using grunt - pig command shell.