Question

How to load data from log file - python scripting?

  • 18 November 2019
  • 4 replies
  • 22 views

Badge +1

Hello to all fans of FME :-)

Please, I work with DGN files and I need to work with its metadata - X/Y/Z origin etc. As I found there (https://knowledge.safe.com/articles/849/how-to-extract-and-use-log-information-in-workbenc.html?childToView=102471#comment-102471 - Extract file or table Metadata part), there is only one way, how to get requested metadate, via Python script.

Anyway, it looks that script works only for one input file (DGNMetadata.fmwt). But if You wanna load metadata from more than 1 file, other features and their attributes are inherited from first loaded feature.

Im not python expert, but I think that it shouldnt works like that.

Please, do You any idea, how to reedit python script to load metadata correctly?

 

Thank You so much!

Lubo


4 replies

Badge

Hi, if you would like to consume log file and use the messages inside, you could use "LogMessageStreamer" transformer. For example in my project, I wrote like this to help analysis the process status and information.

 

Badge +1

Hello @mileslee, it not bad idea!

Anyway you read 3 DGN files and Im still thinking how to merge all info from log about 1 file into one attribute.

As You can see below, this is info from log about one input dgn file and it is repeated two times for another 2 DGN files.

Im still thinking how to do that - get info about XYZ origin for 7700070540_k.dgn file info one attribute, because in Logmessagestreamer, there is no ID for file.

Any ideas?

Thank You so much!

Lubo

Userlevel 1
Badge +10

Hello @mileslee, it not bad idea!

Anyway you read 3 DGN files and Im still thinking how to merge all info from log about 1 file into one attribute.

As You can see below, this is info from log about one input dgn file and it is repeated two times for another 2 DGN files.

Im still thinking how to do that - get info about XYZ origin for 7700070540_k.dgn file info one attribute, because in Logmessagestreamer, there is no ID for file.

Any ideas?

Thank You so much!

Lubo

You can use adjacent attribute handling to create a common ID for adjacent log file messages, then use this value to aggregate into a single text attribute

Badge +1

Hi, if you would like to consume log file and use the messages inside, you could use "LogMessageStreamer" transformer. For example in my project, I wrote like this to help analysis the process status and information.

 

@mileslee , @ebygomm ,

 

thanks to both of You! Finally, I used Your solutions and it works perfectly for my purposes!

Reply